Module: Aws::Resources::OperationMethods

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

Instance Method Summary collapse

Instance Method Details

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



45
46
47
48
# File '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



16
17
18
19
20
21
22
# File '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.



37
38
39
40
# File '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>



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

def batch_operation_names
  @batch_operations.keys.sort
end

#batch_operations(&block) ⇒ Hash



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

def batch_operations(&block)
  @batch_operations.dup
end

#inherited(subclass) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



61
62
63
64
# File 'lib/aws-sdk-resources/operation_methods.rb', line 61

def inherited(subclass)
  subclass.send(:instance_variable_set, "@operations", {})
  subclass.send(:instance_variable_set, "@batch_operations", {})
end

#operation(name) ⇒ Operation

Returns the named operation.



8
9
10
11
# File '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>



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

def operation_names
  @operations.keys.sort
end

#operations(&block) ⇒ Hash



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

def operations(&block)
  @operations.dup
end