vaultkit 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9ac3eb5934d9679c406d5416e2e8b4908ded1d1c077b4d524f621d6c1060d84
4
- data.tar.gz: bc73950e235a0872cce9123e095571c900e94bfd37b501d50abe5d9c9ec617a0
3
+ metadata.gz: e948c993542352fbdc0fe08fd33f8d58b708ffa715e3b4dc849149961945481c
4
+ data.tar.gz: f1682207b5c36a36ac5088de11565807fc443f515fb38dfc22023e0d9559b530
5
5
  SHA512:
6
- metadata.gz: db68da54e37e9ce67826026a74999c400a71324028901522385e93629caafeaec411e08a334dbf734464973556975672ddc4108e0e182adcd8b9a3a53a5a475a
7
- data.tar.gz: '0646974503822fdf9978751a2c4c857ef9b367888b8aa21386b6879b7c800d232137a7c11b4383fd0105aefab5f84be206df25c5cc2742df661ea5999c96899d'
6
+ metadata.gz: 82d742410edb610c37f658433145c6c7f4f3cd42a4a31ea53b7b7d5a7522a3a71d8e475fc282c27c232faf8f96a640f2e51590ea6935466102c9440a5fa11d9a
7
+ data.tar.gz: ddbe999e25dc1214f88182801f0eb59272383867cfb816ac5622b87ed7692cc2b45d2a50ebd94d6637ebb419d2160d5afdb25014edb569de251749b083345737
@@ -134,7 +134,8 @@ module Vkit
134
134
  option :username, required: true
135
135
  option :password, required: true
136
136
  option :config, required: true
137
-
137
+ option :region, required: true, desc: "EU | US | CA | APAC"
138
+ option :environment, required: true, desc: "production | staging | development | sandbox"
138
139
  def add
139
140
  Commands::DatasourceCommand.new.add(
140
141
  id: options[:id],
@@ -8,13 +8,16 @@ module Vkit
8
8
  class DatasourceCommand < BaseCommand
9
9
  REDACT = "[REDACTED]"
10
10
 
11
- def add(id:, engine:, username:, password:, config:)
11
+ def add(id:, engine:, username:, password:, config:, region:, environment:)
12
12
  with_auth do
13
13
  user = require_admin!
14
14
  org = user["organization_slug"]
15
-
15
+
16
+ validate_region!(region)
17
+ validate_environment!(environment)
18
+
16
19
  config_hash = config ? JSON.parse(config) : {}
17
-
20
+
18
21
  response = authenticated_client.post(
19
22
  "/api/v1/orgs/#{org}/datasources",
20
23
  body: {
@@ -22,14 +25,16 @@ module Vkit
22
25
  engine: engine,
23
26
  username: username,
24
27
  password: password,
28
+ region: region.upcase,
29
+ environment: environment,
25
30
  config: config_hash
26
31
  }
27
32
  )
28
-
33
+
29
34
  puts "✅ Datasource created:"
30
35
  print_datasource(response)
31
36
  end
32
- end
37
+ end
33
38
 
34
39
  def list
35
40
  with_auth do
@@ -87,6 +92,18 @@ module Vkit
87
92
  }
88
93
  )
89
94
  end
95
+
96
+ def validate_region!(region)
97
+ unless VALID_REGIONS.include?(region.to_s.upcase)
98
+ raise "Invalid region. Must be one of: #{VALID_REGIONS.join(', ')}"
99
+ end
100
+ end
101
+
102
+ def validate_environment!(env)
103
+ unless VALID_ENVIRONMENTS.include?(env.to_s)
104
+ raise "Invalid environment. Must be one of: #{VALID_ENVIRONMENTS.join(', ')}"
105
+ end
106
+ end
90
107
  end
91
108
  end
92
109
  end
data/lib/vkit/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Vkit
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vaultkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nnamdi Ogundu