Sha256: be85539857906e49c21c8899f1ca75a14dc9c45f74c8cef86ce4872d6ba92450

Contents?: true

Size: 951 Bytes

Versions: 13

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true

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

13 entries across 13 versions & 1 rubygems

Version Path
awspec-1.31.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.30.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.29.3 lib/awspec/helper/finder/apigateway.rb
awspec-1.29.2 lib/awspec/helper/finder/apigateway.rb
awspec-1.29.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.29.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.28.2 lib/awspec/helper/finder/apigateway.rb
awspec-1.28.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.28.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.27.1 lib/awspec/helper/finder/apigateway.rb
awspec-1.27.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.26.0 lib/awspec/helper/finder/apigateway.rb
awspec-1.25.2 lib/awspec/helper/finder/apigateway.rb