You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Module: Aws::Resources::OperationMethods

Included in:
Resource
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb

Instance Method Summary collapse

Instance Method Details

#add_batch_operation(method_name, operation = nil, &definition) ⇒ void

This method returns an undefined value.

Parameters:

  • method_name (Symbol)
  • operation (Operation) (defaults to: nil)


45
46
47
48
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 45

def add_batch_operation(method_name, operation = nil, &definition)
  operation = definition if block_given?
  @batch_operations[method_name.to_sym] = operation
end

#add_operation(method_name, operation = nil, &definition) ⇒ void

This method returns an undefined value.

Parameters:

  • method_name (Symbol)
  • operation (Operation) (defaults to: nil)


16
17
18
19
20
21
22
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 16

def add_operation(method_name, operation = nil, &definition)
  operation = definition if block_given?
  safe_define_method(method_name) do |*args, &block|
    operation.call(resource:self, args:args, block:block)
  end
  @operations[method_name.to_sym] = operation
end

#batch_operation(name) ⇒ Operation

Returns the named batch operation.

Parameters:

  • name (Symbol)

Returns:

  • (Operation)

    Returns the named batch operation.

Raises:



37
38
39
40
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 37

def batch_operation(name)
  @batch_operations[name.to_sym] or
    raise Errors::UnknownOperationError.new(name)
end

#batch_operation_namesArray<Symbol>

Returns:

  • (Array<Symbol>)


56
57
58
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 56

def batch_operation_names
  @batch_operations.keys.sort
end

#batch_operations(&block) ⇒ Hash

Returns:

  • (Hash)


51
52
53
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 51

def batch_operations(&block)
  @batch_operations.dup
end

#operation(name) ⇒ Operation

Returns the named operation.

Parameters:

  • name (Symbol)

Returns:

  • (Operation)

    Returns the named operation.

Raises:



8
9
10
11
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 8

def operation(name)
  @operations[name.to_sym] or
    raise Errors::UnknownOperationError.new(name)
end

#operation_namesArray<Symbol>

Returns:

  • (Array<Symbol>)


30
31
32
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 30

def operation_names
  @operations.keys.sort
end

#operations(&block) ⇒ Hash

Returns:

  • (Hash)


25
26
27
# File 'aws-sdk-resources/lib/aws-sdk-resources/operation_methods.rb', line 25

def operations(&block)
  @operations.dup
end