%% WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
%% See https://github.com/aws-beam/aws-codegen for more details.
%% @doc
ObjectIdentifier
%%
%% QuickStartSchema. For more information, see Managed
%% Schema in the Amazon Cloud Directory Developer Guide.
create_directory(Client, Input) ->
create_directory(Client, Input, []).
create_directory(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/directory/create"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Creates a new Facet in a schema. Facet creation is allowed
%% only in development or applied schemas.
create_facet(Client, Input) ->
create_facet(Client, Input, []).
create_facet(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/facet/create"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Creates an index object. See Indexing
%% and search for more information.
create_index(Client, Input) ->
create_index(Client, Input, []).
create_index(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/index"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Creates an object in a Directory. Additionally attaches the
%% object to a parent, if a parent reference and LinkName is
%% specified. An object is simply a collection of Facet attributes.
%% You can also use this API call to create a policy object, if the facet
%% from which you create the object is a policy facet.
create_object(Client, Input) ->
create_object(Client, Input, []).
create_object(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/object"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Creates a new schema in a development state. A schema can exist in
%% three phases:
%%
%% ObjectType. You can call this on all kinds
%% of schema facets -- published, development, or applied.
get_facet(Client, Input) ->
get_facet(Client, Input, []).
get_facet(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/facet"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves attributes that are associated with a typed link.
get_link_attributes(Client, Input) ->
get_link_attributes(Client, Input, []).
get_link_attributes(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/attributes/get"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves attributes within a facet that are associated with an
%% object.
get_object_attributes(Client, Input) ->
get_object_attributes(Client, Input, []).
get_object_attributes(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/attributes/get"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves metadata about an object.
get_object_information(Client, Input) ->
get_object_information(Client, Input, []).
get_object_information(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/information"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves a JSON representation of the schema. See JSON
%% Schema Format for more information.
get_schema_as_json(Client, Input) ->
get_schema_as_json(Client, Input, []).
get_schema_as_json(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/schema/json"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns the identity attribute order for a specific
%% TypedLinkFacet. For more information, see Typed
%% Links.
get_typed_link_facet_information(Client, Input) ->
get_typed_link_facet_information(Client, Input, []).
get_typed_link_facet_information(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/facet/get"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists schema major versions applied to a directory. If
%% SchemaArn is provided, lists the minor version.
list_applied_schema_arns(Client, Input) ->
list_applied_schema_arns(Client, Input, []).
list_applied_schema_arns(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/schema/applied"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists indices attached to the specified object.
list_attached_indices(Client, Input) ->
list_attached_indices(Client, Input, []).
list_attached_indices(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/indices"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves each Amazon Resource Name (ARN) of schemas in the
%% development state.
list_development_schema_arns(Client, Input) ->
list_development_schema_arns(Client, Input, []).
list_development_schema_arns(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/schema/development"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists directories created within an account.
list_directories(Client, Input) ->
list_directories(Client, Input, []).
list_directories(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/directory/list"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves attributes attached to the facet.
list_facet_attributes(Client, Input) ->
list_facet_attributes(Client, Input, []).
list_facet_attributes(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/facet/attributes"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves the names of facets that exist in a schema.
list_facet_names(Client, Input) ->
list_facet_names(Client, Input, []).
list_facet_names(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/facet/list"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns a paginated list of all the incoming
%% TypedLinkSpecifier information for an object. It also supports
%% filtering by typed link facet and identity attributes. For more
%% information, see Typed
%% Links.
list_incoming_typed_links(Client, Input) ->
list_incoming_typed_links(Client, Input, []).
list_incoming_typed_links(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/incoming"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists objects attached to the specified index.
list_index(Client, Input) ->
list_index(Client, Input, []).
list_index(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/index/targets"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists the major version families of each managed schema. If a major
%% version ARN is provided as SchemaArn, the minor version revisions in that
%% family are listed instead.
list_managed_schema_arns(Client, Input) ->
list_managed_schema_arns(Client, Input, []).
list_managed_schema_arns(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/schema/managed"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists all attributes that are associated with an object.
list_object_attributes(Client, Input) ->
list_object_attributes(Client, Input, []).
list_object_attributes(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/attributes"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns a paginated list of child objects that are associated with a
%% given object.
list_object_children(Client, Input) ->
list_object_children(Client, Input, []).
list_object_children(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/children"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Retrieves all available parent paths for any object type such as
%% node, leaf node, policy node, and index node objects. For more information
%% about objects, see Directory
%% Structure.
%%
%% Use this API to evaluate all parents for an object. The call returns all
%% objects from the root of the directory up to the requested object. The API
%% returns the number of paths based on user-defined MaxResults,
%% in case there are multiple paths to the parent. The order of the paths and
%% nodes returned is consistent among multiple API calls unless the objects
%% are deleted or moved. Paths not leading to the directory root are ignored
%% from the target object.
list_object_parent_paths(Client, Input) ->
list_object_parent_paths(Client, Input, []).
list_object_parent_paths(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/parentpaths"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists parent objects that are associated with a given object in
%% pagination fashion.
list_object_parents(Client, Input) ->
list_object_parents(Client, Input, []).
list_object_parents(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/parent"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns policies attached to an object in pagination fashion.
list_object_policies(Client, Input) ->
list_object_policies(Client, Input, []).
list_object_policies(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/object/policy"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns a paginated list of all the outgoing
%% TypedLinkSpecifier information for an object. It also supports
%% filtering by typed link facet and identity attributes. For more
%% information, see Typed
%% Links.
list_outgoing_typed_links(Client, Input) ->
list_outgoing_typed_links(Client, Input, []).
list_outgoing_typed_links(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/outgoing"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns all of the ObjectIdentifiers to which a given
%% policy is attached.
list_policy_attachments(Client, Input) ->
list_policy_attachments(Client, Input, []).
list_policy_attachments(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/policy/attachment"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-consistency-level", "ConsistencyLevel"},
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists the major version families of each published schema. If a major
%% version ARN is provided as SchemaArn, the minor version
%% revisions in that family are listed instead.
list_published_schema_arns(Client, Input) ->
list_published_schema_arns(Client, Input, []).
list_published_schema_arns(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/schema/published"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns tags for a resource. Tagging is currently supported only for
%% directories with a limit of 50 tags per directory. All 50 tags are
%% returned for a given directory with this API call.
list_tags_for_resource(Client, Input) ->
list_tags_for_resource(Client, Input, []).
list_tags_for_resource(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/tags"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns a paginated list of all attribute definitions for a
%% particular TypedLinkFacet. For more information, see Typed
%% Links.
list_typed_link_facet_attributes(Client, Input) ->
list_typed_link_facet_attributes(Client, Input, []).
list_typed_link_facet_attributes(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/facet/attributes"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Returns a paginated list of TypedLink facet names for a
%% particular schema. For more information, see Typed
%% Links.
list_typed_link_facet_names(Client, Input) ->
list_typed_link_facet_names(Client, Input, []).
list_typed_link_facet_names(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/facet/list"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Lists all policies from the root of the Directory to the
%% object specified. If there are no policies present, an empty list is
%% returned. If policies are present, and if some objects don't have the
%% policies attached, it returns the ObjectIdentifier for such
%% objects. If policies are present, it returns
%% ObjectIdentifier, policyId, and
%% policyType. Paths that don't lead to the root from the target
%% object are ignored. For more information, see Policies.
lookup_policy(Client, Input) ->
lookup_policy(Client, Input, []).
lookup_policy(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/policy/lookup"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Publishes a development schema with a major version and a recommended
%% minor version.
publish_schema(Client, Input) ->
publish_schema(Client, Input, []).
publish_schema(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/schema/publish"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DevelopmentSchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Allows a schema to be updated using JSON upload. Only available for
%% development schemas. See JSON
%% Schema Format for more information.
put_schema_from_json(Client, Input) ->
put_schema_from_json(Client, Input, []).
put_schema_from_json(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/schema/json"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Removes the specified facet from the specified object.
remove_facet_from_object(Client, Input) ->
remove_facet_from_object(Client, Input, []).
remove_facet_from_object(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/object/facets/delete"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc An API operation for adding tags to a resource.
tag_resource(Client, Input) ->
tag_resource(Client, Input, []).
tag_resource(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/tags/add"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc An API operation for removing tags from a resource.
untag_resource(Client, Input) ->
untag_resource(Client, Input, []).
untag_resource(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/tags/remove"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Does the following:
%%
%% Attributes, Rules, or
%% ObjectTypes.
%%
%% Attributes, Rules,
%% or ObjectTypes.
%%
%% Attributes, Rules,
%% or ObjectTypes.
%%
%% IdentityAttributeOrder.
update_link_attributes(Client, Input) ->
update_link_attributes(Client, Input, []).
update_link_attributes(Client, Input0, Options) ->
Method = post,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/attributes/update"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Updates a given object's attributes.
update_object_attributes(Client, Input) ->
update_object_attributes(Client, Input, []).
update_object_attributes(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/object/update"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "DirectoryArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Updates the schema name with a new name. Only development schema
%% names can be updated.
update_schema(Client, Input) ->
update_schema(Client, Input, []).
update_schema(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/schema/update"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Updates a TypedLinkFacet. For more information, see Typed
%% Links.
update_typed_link_facet(Client, Input) ->
update_typed_link_facet(Client, Input, []).
update_typed_link_facet(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/typedlink/facet"],
SuccessStatusCode = 200,
HeadersMapping = [
{"x-amz-data-partition", "SchemaArn"}
],
{Headers, Input} = aws_request:build_headers(HeadersMapping, Input0),
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Upgrades a single directory in-place using the
%% PublishedSchemaArn with schema updates found in
%% MinorVersion. Backwards-compatible minor version upgrades are
%% instantaneously available for readers on all objects in the directory.
%% Note: This is a synchronous API call and upgrades only one schema on a
%% given directory per call. To upgrade multiple directories from one schema,
%% you would need to call this API on each directory.
upgrade_applied_schema(Client, Input) ->
upgrade_applied_schema(Client, Input, []).
upgrade_applied_schema(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/schema/upgradeapplied"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%% @doc Upgrades a published schema under a new minor version revision using
%% the current contents of DevelopmentSchemaArn.
upgrade_published_schema(Client, Input) ->
upgrade_published_schema(Client, Input, []).
upgrade_published_schema(Client, Input0, Options) ->
Method = put,
Path = ["/amazonclouddirectory/2017-01-11/schema/upgradepublished"],
SuccessStatusCode = 200,
Headers = [],
Input = Input0,
request(Client, Method, Path, Headers, Input, Options, SuccessStatusCode).
%%====================================================================
%% Internal functions
%%====================================================================
-spec request(aws_client:aws_client(), atom(), iolist(),
list(), map() | undefined, list(), pos_integer() | undefined) ->
{ok, Result, {integer(), list(), hackney:client()}} |
{error, Error, {integer(), list(), hackney:client()}} |
{error, term()} when
Result :: map() | undefined,
Error :: {binary(), binary()}.
request(Client, Method, Path, Headers0, Input, Options, SuccessStatusCode) ->
Client1 = Client#{service => <<"clouddirectory">>},
Host = get_host(<<"clouddirectory">>, Client1),
URL = get_url(Host, Path, Client1),
Headers1 = [
{<<"Host">>, Host},
{<<"Content-Type">>, <<"application/x-amz-json-1.1">>}
| Headers0
],
Payload = encode_payload(Input),
MethodBin = aws_request:method_to_binary(Method),
SignedHeaders = aws_request:sign_request(Client1, MethodBin, URL, Headers1, Payload),
Response = hackney:request(Method, URL, SignedHeaders, Payload, Options),
handle_response(Response, SuccessStatusCode).
handle_response({ok, StatusCode, ResponseHeaders, Client}, SuccessStatusCode)
when StatusCode =:= 200;
StatusCode =:= 202;
StatusCode =:= 204;
StatusCode =:= SuccessStatusCode ->
case hackney:body(Client) of
{ok, <<>>} when StatusCode =:= 200;
StatusCode =:= SuccessStatusCode ->
{ok, undefined, {StatusCode, ResponseHeaders, Client}};
{ok, Body} ->
Result = jsx:decode(Body, [return_maps]),
{ok, Result, {StatusCode, ResponseHeaders, Client}}
end;
handle_response({ok, StatusCode, ResponseHeaders, Client}, _) ->
{ok, Body} = hackney:body(Client),
Error = jsx:decode(Body, [return_maps]),
Reason1 = maps:get(<<"message">>, Error, undefined),
Reason2 = maps:get(<<"Message">>, Error, Reason1),
{error, Reason2, {StatusCode, ResponseHeaders, Client}};
handle_response({error, Reason}, _) ->
{error, Reason}.
get_host(_EndpointPrefix, #{region := <<"local">>}) ->
<<"localhost">>;
get_host(EndpointPrefix, #{region := Region, endpoint := Endpoint}) ->
aws_util:binary_join([EndpointPrefix, <<".">>, Region, <<".">>, Endpoint], <<"">>).
get_url(Host, Path0, Client) ->
Proto = maps:get(proto, Client),
Path = erlang:iolist_to_binary(Path0),
Port = maps:get(port, Client),
aws_util:binary_join([Proto, <<"://">>, Host, <<":">>, Port, Path], <<"">>).
-spec encode_payload(undefined | map()) -> binary().
encode_payload(undefined) ->
<<>>;
encode_payload(Input) ->
jsx:encode(Input).