Class: Fog::AWS::DataPipeline::Real
- Inherits:
-
Object
- Object
- Fog::AWS::DataPipeline::Real
- Includes:
- CredentialFetcher::ConnectionMethods
- Defined in:
- lib/fog/aws/data_pipeline.rb,
lib/fog/aws/requests/data_pipeline/query_objects.rb,
lib/fog/aws/requests/data_pipeline/list_pipelines.rb,
lib/fog/aws/requests/data_pipeline/create_pipeline.rb,
lib/fog/aws/requests/data_pipeline/delete_pipeline.rb,
lib/fog/aws/requests/data_pipeline/describe_objects.rb,
lib/fog/aws/requests/data_pipeline/activate_pipeline.rb,
lib/fog/aws/requests/data_pipeline/describe_pipelines.rb,
lib/fog/aws/requests/data_pipeline/get_pipeline_definition.rb,
lib/fog/aws/requests/data_pipeline/put_pipeline_definition.rb
Defined Under Namespace
Classes: JSONObject
Instance Attribute Summary collapse
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
-
#activate_pipeline(id) ⇒ Object
Activate a pipeline docs.aws.amazon.com/datapipeline/latest/APIReference/API_ActivatePipeline.html ==== Parameters * PipelineId <~String> - The ID of the pipeline to activate ==== Returns * response<~Excon::Response>: * body<~Hash>:.
-
#create_pipeline(unique_id, name, description = nil, tags = nil) ⇒ Object
Create a pipeline docs.aws.amazon.com/datapipeline/latest/APIReference/API_CreatePipeline.html ==== Parameters * UniqueId <~String> - A unique ID for of the pipeline * Name <~String> - The name of the pipeline * Tags <~Hash> - Key/value string pairs to categorize the pipeline * Description <~String> - Description of the pipeline ==== Returns * response<~Excon::Response>: * body<~Hash>:.
-
#delete_pipeline(id) ⇒ Object
Delete a pipeline docs.aws.amazon.com/datapipeline/latest/APIReference/API_DeletePipeline.html ==== Parameters * PipelineId <~String> - The id of the pipeline to delete ==== Returns * success<~Boolean> - Whether the delete was successful.
-
#describe_objects(id, objectIds, options = {}) ⇒ Object
Queries a pipeline for the names of objects that match a specified set of conditions.
-
#describe_pipelines(ids) ⇒ Object
Describe pipelines docs.aws.amazon.com/datapipeline/latest/APIReference/API_DescribePipelines.html ==== Parameters * PipelineIds <~String> - ID of pipeline to retrieve information for ==== Returns * response<~Excon::Response>: * body<~Hash>:.
-
#get_pipeline_definition(id) ⇒ Object
Get pipeline definition JSON docs.aws.amazon.com/datapipeline/latest/APIReference/API_GetPipelineDefinition.html ==== Parameters * PipelineId <~String> - The ID of the pipeline ==== Returns * response<~Excon::Response>: * body<~Hash>:.
-
#initialize(options = {}) ⇒ Real
constructor
Initialize connection to DataPipeline.
-
#list_pipelines(options = {}) ⇒ Object
List all pipelines docs.aws.amazon.com/datapipeline/latest/APIReference/API_ListPipelines.html ==== Parameters * Marker <~String> - The starting point for the results to be returned.
- #owner_id ⇒ Object
-
#put_pipeline_definition(id, objects) ⇒ Object
Put raw pipeline definition JSON docs.aws.amazon.com/datapipeline/latest/APIReference/API_PutPipelineDefinition.html ==== Parameters * PipelineId <~String> - The ID of the pipeline * PipelineObjects <~String> - Objects in the pipeline ==== Returns * response<~Excon::Response>: * body<~Hash>:.
-
#query_objects(id, sphere, options = {}) ⇒ Object
Queries a pipeline for the names of objects that match a specified set of conditions.
- #reload ⇒ Object
-
#transform_objects(objects) ⇒ Object
Take a list of pipeline object hashes as specified in the Data Pipeline JSON format and transform it into the format expected by the API.
Methods included from CredentialFetcher::ConnectionMethods
#refresh_credentials_if_expired
Constructor Details
#initialize(options = {}) ⇒ Real
Initialize connection to DataPipeline
Notes
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
Examples
datapipeline = DataPipeline.new(
:aws_access_key_id => your_aws_access_key_id,
:aws_secret_access_key => your_aws_secret_access_key
)
Parameters
-
options<~Hash> - config arguments for connection. Defaults to {}.
-
region<~String> - optional region to use. For instance, ‘eu-west-1’, ‘us-east-1’ and etc.
-
Returns
-
DataPipeline object with connection to AWS.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/fog/aws/data_pipeline.rb', line 54 def initialize(={}) @use_iam_profile = [:use_iam_profile] @instrumentor = [:instrumentor] @instrumentor_name = [:instrumentor_name] || 'fog.aws.data_pipeline' @connection_options = [:connection_options] || {} @version = '2012-10-29' @region = [:region] || 'us-east-1' @host = [:host] || "datapipeline.#{@region}.amazonaws.com" @path = [:path] || '/' @persistent = [:persistent] || false @port = [:port] || 443 @scheme = [:scheme] || 'https' @connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options) setup_credentials() end |
Instance Attribute Details
#region ⇒ Object (readonly)
Returns the value of attribute region.
33 34 35 |
# File 'lib/fog/aws/data_pipeline.rb', line 33 def region @region end |
Instance Method Details
#activate_pipeline(id) ⇒ Object
Activate a pipeline docs.aws.amazon.com/datapipeline/latest/APIReference/API_ActivatePipeline.html
Parameters
-
PipelineId <~String> - The ID of the pipeline to activate
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/fog/aws/requests/data_pipeline/activate_pipeline.rb', line 12 def activate_pipeline(id) params = { 'pipelineId' => id } response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.ActivatePipeline' }, }) Fog::JSON.decode(response.body) end |
#create_pipeline(unique_id, name, description = nil, tags = nil) ⇒ Object
Create a pipeline docs.aws.amazon.com/datapipeline/latest/APIReference/API_CreatePipeline.html
Parameters
-
UniqueId <~String> - A unique ID for of the pipeline
-
Name <~String> - The name of the pipeline
-
Tags <~Hash> - Key/value string pairs to categorize the pipeline
-
Description <~String> - Description of the pipeline
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/fog/aws/requests/data_pipeline/create_pipeline.rb', line 15 def create_pipeline(unique_id, name, description=nil, =nil) params = { 'uniqueId' => unique_id, 'name' => name, } params['tags'] = .map {|k,v| {"key" => k.to_s, "value" => v.to_s}} unless .nil? || .empty? params['Description'] = description if description response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.CreatePipeline' }, }) Fog::JSON.decode(response.body) end |
#delete_pipeline(id) ⇒ Object
Delete a pipeline docs.aws.amazon.com/datapipeline/latest/APIReference/API_DeletePipeline.html
Parameters
-
PipelineId <~String> - The id of the pipeline to delete
Returns
-
success<~Boolean> - Whether the delete was successful
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/fog/aws/requests/data_pipeline/delete_pipeline.rb', line 11 def delete_pipeline(id) params = { 'pipelineId' => id } response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.DeletePipeline' }, }) 200 == response.status end |
#describe_objects(id, objectIds, options = {}) ⇒ Object
Queries a pipeline for the names of objects that match a specified set of conditions. docs.aws.amazon.com/datapipeline/latest/APIReference/API_DescribeObjects.html
Parameters
-
PipelineId <~String> - The ID of the pipeline
-
ObjectIds <~Array> - Identifiers of the pipeline objects that contain the definitions
to be described. You can pass as many as 25 identifiers in a single call to DescribeObjects.
-
Options <~Hash> - A Hash of additional options desrcibed in the API docs.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/requests/data_pipeline/describe_objects.rb', line 16 def describe_objects(id, objectIds, ={}) params = .merge({ 'pipelineId' => id, 'objectIds' => objectIds, }) response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.DescribeObjects' }, }) Fog::JSON.decode(response.body) end |
#describe_pipelines(ids) ⇒ Object
Describe pipelines docs.aws.amazon.com/datapipeline/latest/APIReference/API_DescribePipelines.html
Parameters
-
PipelineIds <~String> - ID of pipeline to retrieve information for
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fog/aws/requests/data_pipeline/describe_pipelines.rb', line 12 def describe_pipelines(ids) params = {} params['pipelineIds'] = ids response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.DescribePipelines' }, }) Fog::JSON.decode(response.body) end |
#get_pipeline_definition(id) ⇒ Object
Get pipeline definition JSON docs.aws.amazon.com/datapipeline/latest/APIReference/API_GetPipelineDefinition.html
Parameters
-
PipelineId <~String> - The ID of the pipeline
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fog/aws/requests/data_pipeline/get_pipeline_definition.rb', line 12 def get_pipeline_definition(id) params = { 'pipelineId' => id, } response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.GetPipelineDefinition' }, }) Fog::JSON.decode(response.body) end |
#list_pipelines(options = {}) ⇒ Object
List all pipelines docs.aws.amazon.com/datapipeline/latest/APIReference/API_ListPipelines.html
Parameters
-
Marker <~String> - The starting point for the results to be returned.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fog/aws/requests/data_pipeline/list_pipelines.rb', line 12 def list_pipelines(={}) params = {} params['Marker'] = [:marker] if [:marker] response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.ListPipelines' }, }) Fog::JSON.decode(response.body) end |
#owner_id ⇒ Object
71 72 73 |
# File 'lib/fog/aws/data_pipeline.rb', line 71 def owner_id @owner_id ||= security_groups.get('default').owner_id end |
#put_pipeline_definition(id, objects) ⇒ Object
Put raw pipeline definition JSON docs.aws.amazon.com/datapipeline/latest/APIReference/API_PutPipelineDefinition.html
Parameters
-
PipelineId <~String> - The ID of the pipeline
-
PipelineObjects <~String> - Objects in the pipeline
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fog/aws/requests/data_pipeline/put_pipeline_definition.rb', line 13 def put_pipeline_definition(id, objects) params = { 'pipelineId' => id, 'pipelineObjects' => transform_objects(objects), } response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.PutPipelineDefinition' }, }) Fog::JSON.decode(response.body) end |
#query_objects(id, sphere, options = {}) ⇒ Object
Queries a pipeline for the names of objects that match a specified set of conditions. docs.aws.amazon.com/datapipeline/latest/APIReference/API_QueryObjects.html
Parameters
-
PipelineId <~String> - The ID of the pipeline
-
Sphere <~String> - Specifies whether the query applies to components or instances.
Allowable values: COMPONENT, INSTANCE, ATTEMPT.
-
Marker <~String> - The starting point for the results to be returned.
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fog/aws/requests/data_pipeline/query_objects.rb', line 15 def query_objects(id, sphere, ={}) params = { 'pipelineId' => id, 'sphere' => sphere, } params['marker'] = [:marker] if [:marker] response = request({ :body => Fog::JSON.encode(params), :headers => { 'X-Amz-Target' => 'DataPipeline.QueryObjects' }, }) Fog::JSON.decode(response.body) end |
#reload ⇒ Object
75 76 77 |
# File 'lib/fog/aws/data_pipeline.rb', line 75 def reload @connection.reset end |
#transform_objects(objects) ⇒ Object
Take a list of pipeline object hashes as specified in the Data Pipeline JSON format and transform it into the format expected by the API
29 30 31 |
# File 'lib/fog/aws/requests/data_pipeline/put_pipeline_definition.rb', line 29 def transform_objects(objects) objects.map { |object| JSONObject.new(object).to_api } end |