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

Class: Aws::Resources::Documenter::BaseOperationDocumenter

Inherits:
Object
  • Object
show all
Includes:
Seahorse::Model::Shapes
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yard_class, resource_class, operation_name, operation) ⇒ BaseOperationDocumenter

Returns a new instance of BaseOperationDocumenter



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 11

def initialize(yard_class, resource_class, operation_name, operation)
  @yard_class = yard_class
  @resource_class = resource_class
  @resource_class_name = @resource_class.name.split('::').last
  @operation_name = operation_name.to_s
  @operation = operation
  @source = @operation.source
  if @operation.respond_to?(:request)
    @api_request_name = @operation.request.method_name
    @api_request = @resource_class.client_class.api.operation(@api_request_name)
    @api_request_params = @operation.request.params
    @request_operation_name = @operation.request.method_name.to_s
    @called_operation = "Client##{@api_request_name}"
    @yard_client_operation = YARD::Registry["#{@resource_class.client_class.name}##{api_request_name}"]

  end
  if @operation.respond_to?(:builder)
    @builder = @operation.builder
    @target_resource_class = @builder.resource_class
    @target_resource_class_name = @target_resource_class.name.split('::').last
  end
end

Instance Attribute Details

#api_requestSeahorse::Model::Operation? (readonly)

Returns the model of the API operation called. Returns nil if this operation does not make any API requests.

Returns:

  • (Seahorse::Model::Operation, nil)

    Returns the model of the API operation called. Returns nil if this operation does not make any API requests.



71
72
73
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 71

def api_request
  @api_request
end

#api_request_nameString? (readonly)

Returns the name of the API operation called on the client. Returns nil if this operation does not make any API requests.

Returns:

  • (String, nil)

    Returns the name of the API operation called on the client. Returns nil if this operation does not make any API requests.



66
67
68
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 66

def api_request_name
  @api_request_name
end

#api_request_paramsArray<Resources::RequestParams::Base>? (readonly)

Returns the parameters this operation binds to the made request. Returns nil if this operation does not make a request.

Returns:

  • (Array<Resources::RequestParams::Base>, nil)

    Returns the parameters this operation binds to the made request. Returns nil if this operation does not make a request.



76
77
78
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 76

def api_request_params
  @api_request_params
end

#builderBuilder? (readonly)

Returns the resource builder for this operation. Returns nil if this operation does not build and return resource objects.

Returns:

  • (Builder, nil)

    Returns the resource builder for this operation. Returns nil if this operation does not build and return resource objects.



85
86
87
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 85

def builder
  @builder
end

#called_operationString? (readonly)

Returns the Client#operation_name reference. This is useful for generating @see tags and {links}.

Returns:

  • (String, nil)

    Returns the Client#operation_name reference. This is useful for generating @see tags and {links}.



80
81
82
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 80

def called_operation
  @called_operation
end

#operation_nameString (readonly)

Returns The name of this resource operation.

Returns:

  • (String)

    The name of this resource operation.



42
43
44
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 42

def operation_name
  @operation_name
end

#resource_classClass<Resource> (readonly)

Returns the resource class this operation belongs to.

Returns:

  • (Class<Resource>)

    Returns the resource class this operation belongs to.



39
40
41
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 39

def resource_class
  @resource_class
end

#resource_class_nameString (readonly)

Returns the name of the resource class being documented without the namespace prefix. Example:

  • Aws::S3::Resource => 'Resource'
  • Aws::S3::Bucket => 'Bucket'

Returns:

  • (String)

    Returns the name of the resource class being documented without the namespace prefix. Example:

    • Aws::S3::Resource => 'Resource'
    • Aws::S3::Bucket => 'Bucket'


50
51
52
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 50

def resource_class_name
  @resource_class_name
end

#sourceSource (readonly)

Returns:



88
89
90
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 88

def source
  @source
end

#target_resource_classClass<Resource>? (readonly)

Returns the class of the resource returned by invoking this operation. Returns nil if this operation does not return any resource objects.

Returns:

  • (Class<Resource>, nil)

    Returns the class of the resource returned by invoking this operation. Returns nil if this operation does not return any resource objects.



55
56
57
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 55

def target_resource_class
  @target_resource_class
end

#target_resource_class_nameString? (readonly)

Returns the name of the resource class returned by this operation. This is the base name of the class without a namespace prefix. Returns nil if this operation does not return any resource objects.

Returns:

  • (String, nil)

    Returns the name of the resource class returned by this operation. This is the base name of the class without a namespace prefix. Returns nil if this operation does not return any resource objects.



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

def target_resource_class_name
  @target_resource_class_name
end

#yard_classYARD::CodeObject::ClassObject (readonly)

Returns:

  • (YARD::CodeObject::ClassObject)


35
36
37
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 35

def yard_class
  @yard_class
end

Instance Method Details

#method_objectYARD::CodeObject::MethodObject

Constructs and returns a new YARD method object for this operation.

Returns:

  • (YARD::CodeObject::MethodObject)


92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'aws-sdk-resources/lib/aws-sdk-resources/documenter/base_operation_documenter.rb', line 92

def method_object
  if m = YARD::Registry[@resource_class.name + "##{operation_name}"]
  else
    m = YARD::CodeObjects::MethodObject.new(yard_class, operation_name)
    m.docstring = docstring
    m.parameters = parameters
  end
  m.scope = :instance
  if source
    m.source_type = :json
    m.source = source.format
    filename = source.file
    filename = filename.match('(aws-sdk-core/apis/.+)')[1]
    m.add_file(filename, nil, true)
  end
  tags.each do |tag|
    m.add_tag(tag)
  end
  m
end