awskeyring 1.1.2 → 1.2.0

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: d6b813b7d04318821e16122cf1c377dd51d48ecef326e8bd67a4d5dfb914b221
4
- data.tar.gz: 81d9c40c0ebff68f61802feb59ebbde9be8ad1745a62abcd01665eb0de163cad
3
+ metadata.gz: 9c691b2c94541dc7bf3562ae06b25231dbc8b04f42a04cb327209424f46c9849
4
+ data.tar.gz: a4c0362c4656c64de13708d44a38a1258da651abc1fb79635d99992b0259fd4a
5
5
  SHA512:
6
- metadata.gz: 64f8f178ec9ac97ba91bfd018b091fd8495ec716933bee81fa53045c03553e7903aaae96ff0d1dfe391f665f324e917059c0bcc509b0c742b13441b41d765cd0
7
- data.tar.gz: 608d9ade4b39d5ea2eab4149c6d1e976c50e0877033012a06f58c0847ed21e566824c77037076aa995a281faf4a85b2a512ffbe7c31c313998a017673960ebaf
6
+ metadata.gz: d7982836f83b748af2e4a64ce91b74f33f7f26a6423919fe0ce114011b8ffae9af61039e93a9307e7caeb97eb60ba22131dc57725d6bedd69529fc80e57c6db2
7
+ data.tar.gz: 79700754547b8ce87008a8624686dac7d362947f48e2e9a8a9904e71522454c53c63ed5edfc0fea5f16f5b2be9409641375836fb78fc0dd1c6f91c7b7b6464ca
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [v1.2.0](https://github.com/servian/awskeyring/tree/v1.2.0) (2020-01-20)
4
+
5
+ [Full Changelog](https://github.com/servian/awskeyring/compare/v1.1.2...v1.2.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Check for existing account keys and role arns [\#56](https://github.com/servian/awskeyring/pull/56) ([tristanmorgan](https://github.com/tristanmorgan))
10
+
3
11
  ## [v1.1.2](https://github.com/servian/awskeyring/tree/v1.1.2) (2020-01-06)
4
12
 
5
13
  [Full Changelog](https://github.com/servian/awskeyring/compare/v1.1.1...v1.1.2)
@@ -87,6 +87,11 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
87
87
  load_keychain.generic_passwords
88
88
  end
89
89
 
90
+ # return an item by accout
91
+ private_class_method def self.item_by_account(account)
92
+ all_items.where(account: account).first
93
+ end
94
+
90
95
  # Add an account item
91
96
  #
92
97
  # @param [String] account The account name to create
@@ -308,6 +313,16 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
308
313
  account_name
309
314
  end
310
315
 
316
+ # Validate access key does not exists
317
+ #
318
+ # @param [String] access_key the associated access key.
319
+ def self.access_key_not_exists(access_key)
320
+ Awskeyring::Validate.access_key(access_key)
321
+ raise 'Access KEY already exists' if item_by_account(access_key)
322
+
323
+ access_key
324
+ end
325
+
311
326
  # Validate role exists
312
327
  #
313
328
  # @param [String] role_name the associated role name.
@@ -327,4 +342,14 @@ module Awskeyring # rubocop:disable Metrics/ModuleLength
327
342
 
328
343
  role_name
329
344
  end
345
+
346
+ # Validate role arn not exists
347
+ #
348
+ # @param [String] role_arn the associated role arn.
349
+ def self.role_arn_not_exists(role_arn)
350
+ Awskeyring::Validate.role_arn(role_arn)
351
+ raise 'Role ARN already exists' if item_by_account(role_arn)
352
+
353
+ role_arn
354
+ end
330
355
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Awskeyring
4
4
  # The Gem's version number
5
- VERSION = '1.1.2'
5
+ VERSION = '1.2.0'
6
6
  # The Gem's homepage
7
7
  HOMEPAGE = 'https://github.com/servian/awskeyring'
8
8
  end
@@ -149,7 +149,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
149
149
  existing: account, message: I18n.t('message.account'), validator: Awskeyring.method(:account_not_exists)
150
150
  )
151
151
  key = ask_check(
152
- existing: options[:key], message: I18n.t('message.key'), validator: Awskeyring::Validate.method(:access_key)
152
+ existing: options[:key], message: I18n.t('message.key'), validator: Awskeyring.method(:access_key_not_exists)
153
153
  )
154
154
  secret = ask_check(
155
155
  existing: options[:secret], message: I18n.t('message.secret'),
@@ -181,7 +181,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
181
181
  limited_to: Awskeyring.list_account_names
182
182
  )
183
183
  key = ask_check(
184
- existing: options[:key], message: I18n.t('message.key'), validator: Awskeyring::Validate.method(:access_key)
184
+ existing: options[:key], message: I18n.t('message.key'), validator: Awskeyring.method(:access_key_not_exists)
185
185
  )
186
186
  secret = ask_check(
187
187
  existing: options[:secret], message: I18n.t('message.secret'),
@@ -207,7 +207,7 @@ class AwskeyringCommand < Thor # rubocop:disable Metrics/ClassLength
207
207
  )
208
208
  arn = ask_check(
209
209
  existing: options[:arn], message: I18n.t('message.arn'),
210
- validator: Awskeyring::Validate.method(:role_arn)
210
+ validator: Awskeyring.method(:role_arn_not_exists)
211
211
  )
212
212
 
213
213
  Awskeyring.add_role(
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awskeyring
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Morgan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-06 00:00:00.000000000 Z
11
+ date: 2020-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-iam