Sha256: fbd1cc624be2970574aac6803e3a55c6f6b935f493e8d6607c781d05a74db7cd

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'addressable/uri'

module Awspec::Type
  class Apigateway < ResourceBase
    aws_resource Aws::APIGateway::Client

    def resource_via_client
      @resource_via_client ||= find_apigateway_by_id(@display_name)
      return @resource_via_client if @resource_via_client
      @resource_via_client = find_apigateway_by_name(@display_name)
    end

    def id
      @id ||= resource_via_client.id if resource_via_client
    end

    def api_resources
      @api_resources.nil? ? @api_resources = find_api_resources_by_id(@id) : @api_resources
    end

    def has_path?(path)
      check_existence
      self.api_resources.each do |resource|
        return true if resource.path == path
      end
      false
    end

    def has_integration_path?(path)
      check_existence
      self.api_resources.each do |resource|
        next if resource.resource_methods.nil?
        resource.resource_methods.each do |_, value|
          uri = Addressable::URI.parse(value.method_integration.uri)
          return true if uri.path == path
        end
      end
      false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cthiesfork-awspec-1.1.0 lib/awspec/type/apigateway.rb