Sha256: 0410f7729a11eeee616a74058014990f59feedc42623f4f40e0ba18f97663b96

Contents?: true

Size: 1.73 KB

Versions: 194

Compression:

Stored size: 1.73 KB

Contents

# frozen_string_literal: true

module Seahorse
  module Model
    class Api

      def initialize
        @metadata = {}
        @operations = {}
        @authorizers = {}
        @endpoint_operation = nil
        @require_endpoint_discovery = false
      end

      # @return [String, nil]
      attr_accessor :version

      # @return [Hash]
      attr_accessor :metadata

      # @return [Symbol|nil]
      attr_accessor :endpoint_operation

      # @return [Boolean|nil]
      attr_accessor :require_endpoint_discovery

      def operations(&block)
        if block_given?
          @operations.each(&block)
        else
          @operations.enum_for(:each)
        end
      end

      def operation(name)
        if @operations.key?(name.to_sym)
          @operations[name.to_sym]
        else
          raise ArgumentError, "unknown operation #{name.inspect}"
        end
      end

      def operation_names
        @operations.keys
      end

      def async_operation_names
        @operations.select {|_, op| op.async }.keys
      end

      def add_operation(name, operation)
        @operations[name.to_sym] = operation
      end

      def authorizers(&block)
        if block_given?
          @authorizers.each(&block)
        else
          @authorizers.enum_for(:each)
        end
      end

      def authorizer(name)
        if @authorizers.key?(name.to_sym)
          @authorizers[name.to_sym]
        else
          raise ArgumentError, "unknown authorizer #{name.inspect}"
        end
      end

      def authorizer_names
        @authorizers.keys
      end

      def add_authorizer(name, authorizer)
        @authorizers[name.to_sym] = authorizer
      end

      def inspect(*args)
        "#<#{self.class.name}>"
      end

    end
  end
end

Version data entries

194 entries across 194 versions & 1 rubygems

Version Path
aws-sdk-core-3.181.1 lib/seahorse/model/api.rb
aws-sdk-core-3.181.0 lib/seahorse/model/api.rb
aws-sdk-core-3.180.3 lib/seahorse/model/api.rb
aws-sdk-core-3.180.2 lib/seahorse/model/api.rb
aws-sdk-core-3.180.1 lib/seahorse/model/api.rb
aws-sdk-core-3.180.0 lib/seahorse/model/api.rb
aws-sdk-core-3.179.0 lib/seahorse/model/api.rb
aws-sdk-core-3.178.0 lib/seahorse/model/api.rb
aws-sdk-core-3.177.0 lib/seahorse/model/api.rb
aws-sdk-core-3.176.1 lib/seahorse/model/api.rb
aws-sdk-core-3.176.0 lib/seahorse/model/api.rb
aws-sdk-core-3.175.0 lib/seahorse/model/api.rb
aws-sdk-core-3.174.0 lib/seahorse/model/api.rb
aws-sdk-core-3.173.1 lib/seahorse/model/api.rb
aws-sdk-core-3.173.0 lib/seahorse/model/api.rb
aws-sdk-core-3.172.0 lib/seahorse/model/api.rb
aws-sdk-core-3.171.1 lib/seahorse/model/api.rb
aws-sdk-core-3.171.0 lib/seahorse/model/api.rb
aws-sdk-core-3.170.1 lib/seahorse/model/api.rb
aws-sdk-core-3.170.0 lib/seahorse/model/api.rb