1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

add support for AWS Data Pipeline's DescribeObjects endpoint

http://docs.aws.amazon.com/datapipeline/latest/APIReference/API_DescribeObjects.html
This commit is contained in:
Matt Gillooly 2013-09-10 14:28:17 -04:00
parent f9f71d54eb
commit 012930a089
4 changed files with 70 additions and 14 deletions

View file

@ -17,6 +17,7 @@ module Fog
request :put_pipeline_definition request :put_pipeline_definition
request :get_pipeline_definition request :get_pipeline_definition
request :query_objects request :query_objects
request :describe_objects
model_path 'fog/aws/models/data_pipeline' model_path 'fog/aws/models/data_pipeline'
model :pipeline model :pipeline

View file

@ -0,0 +1,41 @@
module Fog
module AWS
class DataPipeline
class Real
# Queries a pipeline for the names of objects that match a specified set of conditions.
# http://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.
# ==== Returns
# * response<~Excon::Response>:
# * body<~Hash>:
def describe_objects(id, objectIds)
params = {
'pipelineId' => id,
'objectIds' => objectIds,
}
response = request({
:body => Fog::JSON.encode(params),
:headers => { 'X-Amz-Target' => 'DataPipeline.DescribeObjects' },
})
Fog::JSON.decode(response.body)
end
end
class Mock
def describe_objects(id, objects)
Fog::Mock.not_implemented
end
end
end
end
end

View file

@ -6,6 +6,14 @@ class AWS
'pipelineId' => String, 'pipelineId' => String,
} }
FIELDS = [
{
"key" => String,
"refValue" => Fog::Nullable::String,
"stringValue" => Fog::Nullable::String,
}
]
LIST_PIPELINES = { LIST_PIPELINES = {
"hasMoreResults" => Fog::Nullable::Boolean, "hasMoreResults" => Fog::Nullable::Boolean,
"marker" => Fog::Nullable::String, "marker" => Fog::Nullable::String,
@ -23,19 +31,25 @@ class AWS
"ids" => Fog::Nullable::Array, "ids" => Fog::Nullable::Array,
} }
DESCRIBE_OBJECTS = {
"hasMoreResults" => Fog::Nullable::Boolean,
"marker" => Fog::Nullable::String,
"pipelineObjects" => [
{
'id' => String,
'name' => String,
'fields' => FIELDS,
}
]
}
DESCRIBE_PIPELINES = { DESCRIBE_PIPELINES = {
"pipelineDescriptionList" => [ "pipelineDescriptionList" => [
{ {
"description" => Fog::Nullable::String, "description" => Fog::Nullable::String,
"name" => String, "name" => String,
"pipelineId" => String, "pipelineId" => String,
"fields" => [ "fields" => FIELDS,
{
"key" => String,
"refValue" => Fog::Nullable::String,
"stringValue" => Fog::Nullable::String,
}
]
} }
] ]
} }
@ -50,13 +64,7 @@ class AWS
{ {
"id" => String, "id" => String,
"name" => String, "name" => String,
"fields" => [ "fields" => FIELDS,
{
"key" => String,
"refValue" => Fog::Nullable::String,
"stringValue" => Fog::Nullable::String,
}
]
} }
] ]
} }

View file

@ -64,6 +64,12 @@ Shindo.tests('AWS::DataPipeline | pipeline_tests', ['aws', 'data_pipeline']) do
end end
end end
tests('#describe_objects').formats(AWS::DataPipeline::Formats::DESCRIBE_OBJECTS) do
attempts = Fog::AWS[:data_pipeline].query_objects(@pipeline_id, 'ATTEMPT')
object_ids = attempts['ids'][0..5]
Fog::AWS[:data_pipeline].describe_objects(@pipeline_id, object_ids)
end
tests("#delete_pipeline").returns(true) do tests("#delete_pipeline").returns(true) do
Fog::AWS[:data_pipeline].delete_pipeline(@pipeline_id) Fog::AWS[:data_pipeline].delete_pipeline(@pipeline_id)
end end