Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 85 additions & 81 deletions src/aws_autoscaling.erl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
%%
%% </li> <li> Custom resources provided by your own applications or services
%%
%% </li> <li> Amazon Comprehend document classification endpoints
%%
%% </li> <li> AWS Lambda function provisioned concurrency
%%
%% </li> <li> Amazon Keyspaces (for Apache Cassandra) tables
%%
%% </li> </ul> <b>API Summary</b>
%%
%% The Application Auto Scaling service API includes three key sets of
Expand All @@ -37,11 +43,12 @@
%% recent scaling activity history.
%%
%% </li> <li> Suspend and resume scaling - Temporarily suspend and later
%% resume automatic scaling by calling the <a>RegisterScalableTarget</a>
%% action for any Application Auto Scaling scalable target. You can suspend
%% and resume, individually or in combination, scale-out activities triggered
%% by a scaling policy, scale-in activities triggered by a scaling policy,
%% and scheduled scaling.
%% resume automatic scaling by calling the <a
%% href="https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html">RegisterScalableTarget</a>
%% API action for any Application Auto Scaling scalable target. You can
%% suspend and resume (individually or in combination) scale-out activities
%% that are triggered by a scaling policy, scale-in activities that are
%% triggered by a scaling policy, and scheduled scaling.
%%
%% </li> </ul> To learn more about Application Auto Scaling, including
%% information about granting IAM users required permissions for Application
Expand Down Expand Up @@ -90,9 +97,6 @@
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking.html#delete-target-tracking-policy">Delete
%% a Target Tracking Scaling Policy</a> in the <i>Application Auto Scaling
%% User Guide</i>.
%%
%% To create a scaling policy or update an existing one, see
%% <a>PutScalingPolicy</a>.
delete_scaling_policy(Client, Input)
when is_map(Client), is_map(Input) ->
delete_scaling_policy(Client, Input, []).
Expand All @@ -113,13 +117,14 @@ delete_scheduled_action(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DeleteScheduledAction">>, Input, Options).

%% @doc Deregisters an Application Auto Scaling scalable target.
%% @doc Deregisters an Application Auto Scaling scalable target when you have
%% finished using it. To see which resources have been registered, use <a
%% href="https://docs.aws.amazon.com/autoscaling/application/APIReference/API_DescribeScalableTargets.html">DescribeScalableTargets</a>.
%%
%% Deregistering a scalable target deletes the scaling policies that are
%% associated with it.
%% <note> Deregistering a scalable target deletes the scaling policies and
%% the scheduled actions that are associated with it.
%%
%% To create a scalable target or update an existing one, see
%% <a>RegisterScalableTarget</a>.
%% </note>
deregister_scalable_target(Client, Input)
when is_map(Client), is_map(Input) ->
deregister_scalable_target(Client, Input, []).
Expand All @@ -132,10 +137,6 @@ deregister_scalable_target(Client, Input, Options)
%%
%% You can filter the results using <code>ResourceIds</code> and
%% <code>ScalableDimension</code>.
%%
%% To create a scalable target or update an existing one, see
%% <a>RegisterScalableTarget</a>. If you are no longer using a scalable
%% target, you can deregister it using <a>DeregisterScalableTarget</a>.
describe_scalable_targets(Client, Input)
when is_map(Client), is_map(Input) ->
describe_scalable_targets(Client, Input, []).
Expand All @@ -148,11 +149,6 @@ describe_scalable_targets(Client, Input, Options)
%%
%% You can filter the results using <code>ResourceId</code> and
%% <code>ScalableDimension</code>.
%%
%% Scaling activities are triggered by CloudWatch alarms that are associated
%% with scaling policies. To view the scaling policies for a service
%% namespace, see <a>DescribeScalingPolicies</a>. To create a scaling policy
%% or update an existing one, see <a>PutScalingPolicy</a>.
describe_scaling_activities(Client, Input)
when is_map(Client), is_map(Input) ->
describe_scaling_activities(Client, Input, []).
Expand All @@ -166,9 +162,11 @@ describe_scaling_activities(Client, Input, Options)
%% You can filter the results using <code>ResourceId</code>,
%% <code>ScalableDimension</code>, and <code>PolicyNames</code>.
%%
%% To create a scaling policy or update an existing one, see
%% <a>PutScalingPolicy</a>. If you are no longer using a scaling policy, you
%% can delete it using <a>DeleteScalingPolicy</a>.
%% For more information, see <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking.html">Target
%% Tracking Scaling Policies</a> and <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-step-scaling-policies.html">Step
%% Scaling Policies</a> in the <i>Application Auto Scaling User Guide</i>.
describe_scaling_policies(Client, Input)
when is_map(Client), is_map(Input) ->
describe_scaling_policies(Client, Input, []).
Expand All @@ -183,32 +181,23 @@ describe_scaling_policies(Client, Input, Options)
%% <code>ScalableDimension</code>, and <code>ScheduledActionNames</code>
%% parameters.
%%
%% To create a scheduled action or update an existing one, see
%% <a>PutScheduledAction</a>. If you are no longer using a scheduled action,
%% you can delete it using <a>DeleteScheduledAction</a>.
%% For more information, see <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-scheduled-scaling.html">Scheduled
%% Scaling</a> in the <i>Application Auto Scaling User Guide</i>.
describe_scheduled_actions(Client, Input)
when is_map(Client), is_map(Input) ->
describe_scheduled_actions(Client, Input, []).
describe_scheduled_actions(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"DescribeScheduledActions">>, Input, Options).

%% @doc Creates or updates a policy for an Application Auto Scaling scalable
%% target.
%% @doc Creates or updates a scaling policy for an Application Auto Scaling
%% scalable target.
%%
%% Each scalable target is identified by a service namespace, resource ID,
%% and scalable dimension. A scaling policy applies to the scalable target
%% identified by those three attributes. You cannot create a scaling policy
%% until you have registered the resource as a scalable target using
%% <a>RegisterScalableTarget</a>.
%%
%% To update a policy, specify its policy name and the parameters that you
%% want to change. Any parameters that you don't specify are not changed by
%% this update request.
%%
%% You can view the scaling policies for a service namespace using
%% <a>DescribeScalingPolicies</a>. If you are no longer using a scaling
%% policy, you can delete it using <a>DeleteScalingPolicy</a>.
%% until you have registered the resource as a scalable target.
%%
%% Multiple scaling policies can be in force at the same time for the same
%% scalable target. You can have one or more target tracking scaling
Expand All @@ -221,9 +210,25 @@ describe_scheduled_actions(Client, Input, Options)
%% is 10, Application Auto Scaling uses the policy with the highest
%% calculated capacity (200% of 10 = 20) and scales out to 30.
%%
%% Learn more about how to work with scaling policies in the <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/what-is-application-auto-scaling.html">Application
%% Auto Scaling User Guide</a>.
%% We recommend caution, however, when using target tracking scaling policies
%% with step scaling policies because conflicts between these policies can
%% cause undesirable behavior. For example, if the step scaling policy
%% initiates a scale-in activity before the target tracking policy is ready
%% to scale in, the scale-in activity will not be blocked. After the scale-in
%% activity completes, the target tracking policy could instruct the scalable
%% target to scale out again.
%%
%% For more information, see <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking.html">Target
%% Tracking Scaling Policies</a> and <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-step-scaling-policies.html">Step
%% Scaling Policies</a> in the <i>Application Auto Scaling User Guide</i>.
%%
%% <note> If a scalable target is deregistered, the scalable target is no
%% longer available to execute scaling policies. Any scaling policies that
%% were specified for the scalable target are deleted.
%%
%% </note>
put_scaling_policy(Client, Input)
when is_map(Client), is_map(Input) ->
put_scaling_policy(Client, Input, []).
Expand All @@ -237,50 +242,55 @@ put_scaling_policy(Client, Input, Options)
%% Each scalable target is identified by a service namespace, resource ID,
%% and scalable dimension. A scheduled action applies to the scalable target
%% identified by those three attributes. You cannot create a scheduled action
%% until you have registered the resource as a scalable target using
%% <a>RegisterScalableTarget</a>.
%% until you have registered the resource as a scalable target.
%%
%% When start and end times are specified with a recurring schedule using a
%% cron expression or rates, they form the boundaries of when the recurring
%% action starts and stops.
%%
%% To update an action, specify its name and the parameters that you want to
%% To update a scheduled action, specify the parameters that you want to
%% change. If you don't specify start and end times, the old values are
%% deleted. Any other parameters that you don't specify are not changed by
%% this update request.
%% deleted.
%%
%% For more information, see <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-scheduled-scaling.html">Scheduled
%% Scaling</a> in the <i>Application Auto Scaling User Guide</i>.
%%
%% You can view the scheduled actions using <a>DescribeScheduledActions</a>.
%% If you are no longer using a scheduled action, you can delete it using
%% <a>DeleteScheduledAction</a>.
%% <note> If a scalable target is deregistered, the scalable target is no
%% longer available to run scheduled actions. Any scheduled actions that were
%% specified for the scalable target are deleted.
%%
%% Learn more about how to work with scheduled actions in the <a
%% href="https://docs.aws.amazon.com/autoscaling/application/userguide/what-is-application-auto-scaling.html">Application
%% Auto Scaling User Guide</a>.
%% </note>
put_scheduled_action(Client, Input)
when is_map(Client), is_map(Input) ->
put_scheduled_action(Client, Input, []).
put_scheduled_action(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"PutScheduledAction">>, Input, Options).

%% @doc Registers or updates a scalable target. A scalable target is a
%% resource that Application Auto Scaling can scale out and scale in.
%% Scalable targets are uniquely identified by the combination of resource
%% ID, scalable dimension, and namespace.
%% @doc Registers or updates a scalable target.
%%
%% When you register a new scalable target, you must specify values for
%% minimum and maximum capacity. Application Auto Scaling will not scale
%% capacity to values that are outside of this range.
%% A scalable target is a resource that Application Auto Scaling can scale
%% out and scale in. Scalable targets are uniquely identified by the
%% combination of resource ID, scalable dimension, and namespace.
%%
%% To update a scalable target, specify the parameter that you want to change
%% as well as the following parameters that identify the scalable target:
%% resource ID, scalable dimension, and namespace. Any parameters that you
%% don't specify are not changed by this update request.
%% When you register a new scalable target, you must specify values for
%% minimum and maximum capacity. Application Auto Scaling scaling policies
%% will not scale capacity to values that are outside of this range.
%%
%% After you register a scalable target, you do not need to register it again
%% to use other Application Auto Scaling operations. To see which resources
%% have been registered, use <a>DescribeScalableTargets</a>. You can also
%% view the scaling policies for a service namespace by using
%% <a>DescribeScalableTargets</a>.
%%
%% If you no longer need a scalable target, you can deregister it by using
%% <a>DeregisterScalableTarget</a>.
%% have been registered, use <a
%% href="https://docs.aws.amazon.com/autoscaling/application/APIReference/API_DescribeScalableTargets.html">DescribeScalableTargets</a>.
%% You can also view the scaling policies for a service namespace by using <a
%% href="https://docs.aws.amazon.com/autoscaling/application/APIReference/API_DescribeScalableTargets.html">DescribeScalableTargets</a>.
%% If you no longer need a scalable target, you can deregister it by using <a
%% href="https://docs.aws.amazon.com/autoscaling/application/APIReference/API_DeregisterScalableTarget.html">DeregisterScalableTarget</a>.
%%
%% To update a scalable target, specify the parameters that you want to
%% change. Include the parameters that identify the scalable target: resource
%% ID, scalable dimension, and namespace. Any parameters that you don't
%% specify are not changed by this update request.
register_scalable_target(Client, Input)
when is_map(Client), is_map(Input) ->
register_scalable_target(Client, Input, []).
Expand All @@ -300,22 +310,16 @@ register_scalable_target(Client, Input, Options)
Error :: {binary(), binary()}.
request(Client, Action, Input, Options) ->
Client1 = Client#{service => <<"application-autoscaling">>},
Host = get_host(<<"autoscaling">>, Client1),
Host = get_host(<<"application-autoscaling">>, Client1),
URL = get_url(Host, Client1),
Headers1 =
case maps:get(token, Client1, undefined) of
Token when byte_size(Token) > 0 -> [{<<"X-Amz-Security-Token">>, Token}];
_ -> []
end,
Headers2 = [
Headers = [
{<<"Host">>, Host},
{<<"Content-Type">>, <<"application/x-amz-json-1.1">>},
{<<"X-Amz-Target">>, << <<"AnyScaleFrontendService.">>/binary, Action/binary>>}
| Headers1
],
Payload = jsx:encode(Input),
Headers = aws_request:sign_request(Client1, <<"POST">>, URL, Headers2, Payload),
Response = hackney:request(post, URL, Headers, Payload, Options),
SignedHeaders = aws_request:sign_request(Client1, <<"POST">>, URL, Headers, Payload),
Response = hackney:request(post, URL, SignedHeaders, Payload, Options),
handle_response(Response).

handle_response({ok, 200, ResponseHeaders, Client}) ->
Expand Down
51 changes: 26 additions & 25 deletions src/aws_certificate_manager.erl
Original file line number Diff line number Diff line change
Expand Up @@ -98,28 +98,29 @@ describe_certificate(Client, Input, Options)
request(Client, <<"DescribeCertificate">>, Input, Options).

%% @doc Exports a private certificate issued by a private certificate
%% authority (CA) for use anywhere. You can export the certificate, the
%% certificate chain, and the encrypted private key associated with the
%% public key embedded in the certificate. You must store the private key
%% securely. The private key is a 2048 bit RSA key. You must provide a
%% passphrase for the private key when exporting it. You can use the
%% following OpenSSL command to decrypt it later. Provide the passphrase when
%% prompted.
%% authority (CA) for use anywhere. The exported file contains the
%% certificate, the certificate chain, and the encrypted private 2048-bit RSA
%% key associated with the public key that is embedded in the certificate.
%% For security, you must assign a passphrase for the private key when
%% exporting it.
%%
%% <code>openssl rsa -in encrypted_key.pem -out decrypted_key.pem</code>
%% For information about exporting and formatting a certificate using the ACM
%% console or CLI, see <a
%% href="https://docs.aws.amazon.com/acm/latest/userguide/gs-acm-export-private.html">Export
%% a Private Certificate</a>.
export_certificate(Client, Input)
when is_map(Client), is_map(Input) ->
export_certificate(Client, Input, []).
export_certificate(Client, Input, Options)
when is_map(Client), is_map(Input), is_list(Options) ->
request(Client, <<"ExportCertificate">>, Input, Options).

%% @doc Retrieves a certificate specified by an ARN and its certificate chain
%% . The chain is an ordered list of certificates that contains the end
%% entity certificate, intermediate certificates of subordinate CAs, and the
%% root certificate in that order. The certificate and certificate chain are
%% base64 encoded. If you want to decode the certificate to see the
%% individual fields, you can use OpenSSL.
%% @doc Retrieves an Amazon-issued certificate and its certificate chain. The
%% chain consists of the certificate of the issuing CA and the intermediate
%% certificates of any other subordinate CAs. All of the certificates are
%% base64 encoded. You can use <a
%% href="https://wiki.openssl.org/index.php/Command_Line_Utilities">OpenSSL</a>
%% to decode the certificates and inspect individual fields.
get_certificate(Client, Input)
when is_map(Client), is_map(Input) ->
get_certificate(Client, Input, []).
Expand Down Expand Up @@ -170,7 +171,7 @@ get_certificate(Client, Input, Options)
%%
%% </li> <li> To import a new certificate, omit the
%% <code>CertificateArn</code> argument. Include this argument only when you
%% want to replace a previously imported certificate.
%% want to replace a previously imported certifica
%%
%% </li> <li> When you import a certificate by using the CLI, you must
%% specify the certificate, the certificate chain, and the private key by
Expand All @@ -183,6 +184,10 @@ get_certificate(Client, Input, Options)
%% the certificate, the certificate chain, and the private key files in the
%% manner required by the programming language you're using.
%%
%% </li> <li> The cryptographic algorithm of an imported certificate must
%% match the algorithm of the signing CA. For example, if the signing CA key
%% type is RSA, then the certificate key type must also be RSA.
%%
%% </li> </ul> This operation returns the <a
%% href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon
%% Resource Name (ARN)</a> of the imported certificate.
Expand All @@ -195,7 +200,9 @@ import_certificate(Client, Input, Options)

%% @doc Retrieves a list of certificate ARNs and domain names. You can
%% request that only certificates that match a specific status be listed. You
%% can also filter by specific attributes of the certificate.
%% can also filter by specific attributes of the certificate. Default
%% filtering returns only <code>RSA_2048</code> certificates. For more
%% information, see <a>Filters</a>.
list_certificates(Client, Input)
when is_map(Client), is_map(Input) ->
list_certificates(Client, Input, []).
Expand Down Expand Up @@ -312,20 +319,14 @@ request(Client, Action, Input, Options) ->
Client1 = Client#{service => <<"acm">>},
Host = get_host(<<"acm">>, Client1),
URL = get_url(Host, Client1),
Headers1 =
case maps:get(token, Client1, undefined) of
Token when byte_size(Token) > 0 -> [{<<"X-Amz-Security-Token">>, Token}];
_ -> []
end,
Headers2 = [
Headers = [
{<<"Host">>, Host},
{<<"Content-Type">>, <<"application/x-amz-json-1.1">>},
{<<"X-Amz-Target">>, << <<"CertificateManager.">>/binary, Action/binary>>}
| Headers1
],
Payload = jsx:encode(Input),
Headers = aws_request:sign_request(Client1, <<"POST">>, URL, Headers2, Payload),
Response = hackney:request(post, URL, Headers, Payload, Options),
SignedHeaders = aws_request:sign_request(Client1, <<"POST">>, URL, Headers, Payload),
Response = hackney:request(post, URL, SignedHeaders, Payload, Options),
handle_response(Response).

handle_response({ok, 200, ResponseHeaders, Client}) ->
Expand Down
Loading