Sha256: c45c58612143c360fc446dbc143cf09d69e9d74a7a86fb86dc2fe70c7aaa324b

Contents?: true

Size: 920 Bytes

Versions: 21

Compression:

Stored size: 920 Bytes

Contents

module Awspec::Helper
  module Finder
    module Apigateway
      def find_apigateway_by_id(id)
        apis = []
        apigateway_client.get_rest_apis(limit: 500).each do |response|
          apis += response.items
        end
        apis.each do |api|
          return api if api.id == id
        end
        nil
      end

      def find_apigateway_by_name(name)
        apis = []
        apigateway_client.get_rest_apis(limit: 500).each do |response|
          apis += response.items
        end
        apis.each do |api|
          return api if api.name == name
        end
        nil
      end

      def find_api_resources_by_id(api_id)
        all_resources = []
        apigateway_client.get_resources(rest_api_id: api_id, limit: 500, embed: ['methods']).each do |response|
          all_resources += response.items
        end
        all_resources != [] ? all_resources : nil
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 3 rubygems

Version Path
awspec-1.25.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.25.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.24.4 lib/awspec/helper/finder/apigateway.rb
awspec-1.24.3 lib/awspec/helper/finder/apigateway.rb
awspec-1.24.2 lib/awspec/helper/finder/apigateway.rb
awspec-1.24.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.24.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.23.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.22.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.22.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.21.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.21.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.20.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.19.2 lib/awspec/helper/finder/apigateway.rb
awspec-1.19.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.19.0 lib/awspec/helper/finder/apigateway.rb
cthiesfork-awspec-1.2.4 lib/awspec/helper/finder/apigateway.rb
awspec-api_gateway_extended-1.2.4 lib/awspec/helper/finder/apigateway.rb
awspec-api_gateway_extended-1.2.3 lib/awspec/helper/finder/apigateway.rb
cthiesfork-awspec-1.2.2 lib/awspec/helper/finder/apigateway.rb