awspec 1.18.6 → 1.19.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: 4153cb88f0be5b9a51b18062dd8be99c748b389086ec50353120901fb180440e
4
- data.tar.gz: 921989d56838615417a2f0b2cbe691fab6d255b092a8b7131376809ad9107e12
3
+ metadata.gz: 104554ac52e531f7d2ddbca1c80dad6f767bdbffad5fe37d389c8a067cfb51d8
4
+ data.tar.gz: d07bc9d59cad74e8e965c93a5e8921a1705c29ae2560e1a560c441056e7e37a7
5
5
  SHA512:
6
- metadata.gz: a82d4ca591f00cc86520539604303eeee2363aa003dd8f7c0710242faec71a6b993096b5069906a6387cdb7edebad06179482d716840197131b244d1289314c2
7
- data.tar.gz: c99f333f8ccc7c84e2a2b9402de0b21f57facb3ef1f46cf9f9e46e7c28d57c666b7034959c6b72714c228c87e0f9be307ca0ac40d1f01a207ba674cea664004f
6
+ metadata.gz: 84b19f725a887d11227d951cffbb82c6f22f02154154f2c722bcbfe24cfaeac9a13a7317b8daf0a1160417d28f7723945d9a6d3ee41bff506ebdb73ab87e89b2
7
+ data.tar.gz: dde35d185574f58977c4327e619b533a342db008d6af9e499b9344e11dc4314a6bea6c2798ac721be38c58c1d5685383257a71d5275f35d1f2848dc5d9e56154
@@ -29,6 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.add_runtime_dependency 'rspec-its'
30
30
  spec.add_runtime_dependency 'term-ansicolor'
31
31
  spec.add_runtime_dependency 'thor'
32
+ spec.add_runtime_dependency 'addressable'
32
33
  spec.add_development_dependency 'bundler', '>= 1.9', '< 3.0'
33
34
  spec.add_development_dependency 'octorelease'
34
35
  spec.add_development_dependency 'pry'
@@ -284,6 +284,14 @@ describe apigateway('my-apigateway') do
284
284
  end
285
285
  ```
286
286
 
287
+ ### have_integration_method
288
+
289
+ ### have_integration_path
290
+
291
+ ### have_method
292
+
293
+ ### have_path
294
+
287
295
  ### its(:id), its(:name), its(:description), its(:created_date), its(:version), its(:warnings), its(:binary_media_types), its(:minimum_compression_size), its(:api_key_source), its(:policy), its(:tags)
288
296
  ## <a name="autoscaling_group">autoscaling_group</a>
289
297
 
@@ -1612,7 +1620,7 @@ describe emr('my-emr') do
1612
1620
  end
1613
1621
  ```
1614
1622
 
1615
- ### its(:id), its(:name), its(:instance_collection_type), its(:log_uri), its(:requested_ami_version), its(:running_ami_version), its(:release_label), its(:auto_terminate), its(:termination_protected), its(:visible_to_all_users), its(:service_role), its(:normalized_instance_hours), its(:master_public_dns_name), its(:configurations), its(:security_configuration), its(:auto_scaling_role), its(:scale_down_behavior), its(:custom_ami_id), its(:ebs_root_volume_size), its(:repo_upgrade_on_boot), its(:cluster_arn), its(:step_concurrency_level), its(:outpost_arn)
1623
+ ### its(:id), its(:name), its(:instance_collection_type), its(:log_uri), its(:requested_ami_version), its(:running_ami_version), its(:release_label), its(:auto_terminate), its(:termination_protected), its(:visible_to_all_users), its(:service_role), its(:normalized_instance_hours), its(:master_public_dns_name), its(:configurations), its(:security_configuration), its(:auto_scaling_role), its(:scale_down_behavior), its(:custom_ami_id), its(:ebs_root_volume_size), its(:repo_upgrade_on_boot), its(:cluster_arn), its(:outpost_arn), its(:step_concurrency_level)
1616
1624
  ## <a name="firehose">firehose</a>
1617
1625
 
1618
1626
  Firehose resource type.
@@ -3381,7 +3389,7 @@ end
3381
3389
  ```
3382
3390
 
3383
3391
 
3384
- ### its(:name), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version), its(:tier), its(:policies)
3392
+ ### its(:name), its(:type), its(:key_id), its(:last_modified_date), its(:last_modified_user), its(:description), its(:allowed_pattern), its(:version), its(:tier), its(:policies), its(:data_type)
3385
3393
  ### :unlock: Advanced use
3386
3394
 
3387
3395
  ```ruby
@@ -3425,7 +3433,7 @@ end
3425
3433
  ```
3426
3434
 
3427
3435
 
3428
- ### its(:availability_zone), its(:availability_zone_id), its(:available_ip_address_count), its(:cidr_block), its(:default_for_az), its(:map_public_ip_on_launch), its(:state), its(:subnet_id), its(:vpc_id), its(:owner_id), its(:assign_ipv_6_address_on_creation), its(:ipv_6_cidr_block_association_set), its(:subnet_arn), its(:outpost_arn)
3436
+ ### its(:availability_zone), its(:availability_zone_id), its(:available_ip_address_count), its(:cidr_block), its(:default_for_az), its(:map_public_ip_on_launch), its(:map_customer_owned_ip_on_launch), its(:customer_owned_ipv_4_pool), its(:state), its(:subnet_id), its(:vpc_id), its(:owner_id), its(:assign_ipv_6_address_on_creation), its(:ipv_6_cidr_block_association_set), its(:subnet_arn), its(:outpost_arn)
3429
3437
  ### :unlock: Advanced use
3430
3438
 
3431
3439
  `subnet` can use `Aws::EC2::Subnet` resource (see http://docs.aws.amazon.com/sdkforruby/api/Aws/EC2/Subnet.html).
@@ -22,6 +22,14 @@ module Awspec::Helper
22
22
  end
23
23
  nil
24
24
  end
25
+
26
+ def find_api_resources_by_id(api_id)
27
+ all_resources = []
28
+ apigateway_client.get_resources(rest_api_id: api_id, limit: 500, embed: ['methods']).each do |response|
29
+ all_resources += response.items
30
+ end
31
+ all_resources != [] ? all_resources : nil
32
+ end
25
33
  end
26
34
  end
27
35
  end
@@ -70,6 +70,45 @@ Aws.config[:apigateway] = {
70
70
  }
71
71
  }
72
72
  ]
73
+ },
74
+ get_resources: {
75
+ position: '1',
76
+ items: [
77
+ {
78
+ path: '/proxy',
79
+ resource_methods: {
80
+ 'GET' => {
81
+ http_method: 'GET',
82
+ method_integration: { http_method: 'POST', uri: 'http://127.0.0.1:8080/hockey' }
83
+ }
84
+ }
85
+ },
86
+ {
87
+ path: '/zambonis',
88
+ resource_methods: {
89
+ 'POST' => {
90
+ http_method: 'POST',
91
+ method_integration: { http_method: 'POST',
92
+ uri: 'http://127.0.0.1:8080/zambonis/{arena}?arena=Saddledome' }
93
+ }
94
+ }
95
+ },
96
+ {
97
+ path: '/zambonis/123',
98
+ resource_methods: {
99
+ 'POST' => {
100
+ http_method: 'POST',
101
+ method_integration: { http_method: 'AWS',
102
+ uri: 'arn:aws:apigateway:us-east-1:cognito-idp:action/ListUsers' }
103
+ },
104
+ 'GET' => {
105
+ http_method: 'GET',
106
+ method_integration: { http_method: 'AWS',
107
+ uri: 'arn:aws:apigateway:us-east-1:cognito-idp:action/SignUp?username=test' }
108
+ }
109
+ }
110
+ }
111
+ ]
73
112
  }
74
113
  }
75
114
  }
@@ -1,3 +1,5 @@
1
+ require 'addressable/uri'
2
+
1
3
  module Awspec::Type
2
4
  class Apigateway < ResourceBase
3
5
  aws_resource Aws::APIGateway::Client
@@ -11,5 +13,53 @@ module Awspec::Type
11
13
  def id
12
14
  @id ||= resource_via_client.id if resource_via_client
13
15
  end
16
+
17
+ def api_resources
18
+ @api_resources.nil? ? @api_resources = find_api_resources_by_id(@id) : @api_resources
19
+ end
20
+
21
+ def has_path?(path)
22
+ check_existence
23
+ self.api_resources.each do |resource|
24
+ return resource if resource.path == path
25
+ end
26
+ nil
27
+ end
28
+
29
+ def has_integration_path?(path)
30
+ check_existence
31
+ self.api_resources.each do |resource|
32
+ next if resource.resource_methods.nil?
33
+ resource.resource_methods.each do |_, method|
34
+ if method.method_integration.http_method == 'AWS'
35
+ aws_path = method.method_integration.uri.match(%r{(\/[^\?]+)\??.*$}).captures[0] # Matches for ARN type path
36
+ return resource if aws_path == path
37
+ end
38
+ uri = Addressable::URI.parse(method.method_integration.uri)
39
+ return resource if uri.path == path
40
+ end
41
+ end
42
+ nil
43
+ end
44
+
45
+ def has_method?(path, http_method)
46
+ check_existence
47
+ resource_to_check = has_path?(path)
48
+ return nil if resource_to_check.nil?
49
+ resource_to_check.resource_methods.each do |_, method|
50
+ return resource_to_check if method.http_method == http_method
51
+ end
52
+ nil
53
+ end
54
+
55
+ def has_integration_method?(integration_path, http_method)
56
+ check_existence
57
+ integration_resource_to_check = has_integration_path?(integration_path)
58
+ return nil if integration_resource_to_check.nil?
59
+ integration_resource_to_check.resource_methods.each do |_, method|
60
+ return integration_resource_to_check if method.method_integration.http_method == http_method
61
+ end
62
+ nil
63
+ end
14
64
  end
15
65
  end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.18.6'
2
+ VERSION = '1.19.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.18.6
4
+ version: 1.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-26 00:00:00.000000000 Z
11
+ date: 2020-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: addressable
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: bundler
127
141
  requirement: !ruby/object:Gem::Requirement