initialize

in build_tools/aws-sdk-code-generator/lib/aws-sdk-code-generator/client_operation_list.rb [7:128]


    def initialize(options)
      api = options.fetch(:api)
      examples = options.fetch(:examples, {})
      module_name = options.fetch(:module_name)
      protocol = options.fetch(:protocol)
      protocol_settings = options.fetch(:protocol_settings, {})
      client_examples = options.fetch(:client_examples, {})
      paginators = options.fetch(:paginators, {})
      operation_waiters = Waiter.build_operations_map(options[:waiters])
      @operations = api['operations'].each_with_object([]) do |(name, operation), ops|
        method_name = Underscore.underscore(name)
        waiters = operation_waiters[method_name]
        async_client = options[:async_client] || false
        es_output = AwsSdkCodeGenerator::Helper.eventstream_output?(operation, api)
        es_input = AwsSdkCodeGenerator::Helper.eventstream_input?(operation, api)

        if async_client
          if es_input || es_output
            if es_input == es_output
              
              es_input = "Input" + es_input
              es_output = "Output" + es_output
            end

            case protocol_settings['h2']
            when 'required'
              
              raise NotImplementedError, 'H2 required is not implemented yet'
            when 'optional'
              
              
              next unless es_input && es_output

              ops << Operation.new(
                name: method_name,
                documentation: ClientOperationDocumentation.new(
                  name: name,
                  module_name: module_name,
                  method_name: method_name,
                  operation: operation,
                  api: api,
                  protocol: protocol,
                  examples: examples,
                  client_examples: client_examples[method_name] || [],
                  async_client: true
                ).to_s,
                streaming: AwsSdkCodeGenerator::Helper.operation_streaming?(operation, api),
                eventstream_output: es_output,
                eventstream_input: es_input
              )
            when 'eventstream'
              
              
              
              ops << Operation.new(
                name: method_name,
                documentation: ClientOperationDocumentation.new(
                  name: name,
                  module_name: module_name,
                  method_name: method_name,
                  operation: operation,
                  api: api,
                  protocol: protocol,
                  examples: examples,
                  client_examples: client_examples[method_name] || [],
                  async_client: true
                ).to_s,
                streaming: AwsSdkCodeGenerator::Helper.operation_streaming?(operation, api),
                eventstream_output: es_output,
                eventstream_input: es_input
              )
            end
          end
        else
          
          
          
          if !es_input && es_output && protocol_settings['h2'] != 'eventstream'
            ops << Operation.new(
              name: method_name,
              documentation: ClientOperationDocumentation.new(
                name: name,
                module_name: module_name,
                method_name: method_name,
                operation: operation,
                api: api,
                protocol: protocol,
                examples: examples,
                client_examples: client_examples[method_name] || [],
                async_client: false
              ).to_s,
              streaming: AwsSdkCodeGenerator::Helper.operation_streaming?(operation, api),
              eventstream_output: es_output,
              eventstream_input: false
            )
          
          elsif !es_input && !es_output
            ops << Operation.new(
              name: method_name,
              documentation: ClientOperationDocumentation.new(
                name: name,
                module_name: module_name,
                method_name: method_name,
                operation: operation,
                api: api,
                protocol: protocol,
                examples: examples,
                client_examples: client_examples[method_name] || [],
                async_client: false,
                pager: paginators && paginators['pagination'][name],
                waiters: waiters
              ).to_s,
              streaming: AwsSdkCodeGenerator::Helper.operation_streaming?(operation, api),
              eventstream_output: false,
              eventstream_input: false
            )
          end
        end
        ops
      end
    end