Skip to content

Commit 772809e

Browse files
committed
Add generated clients.
1 parent be31213 commit 772809e

22 files changed

+6731
-54
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/_build
22
/deps
3+
/doc
34
erl_crash.dump
45
*.ez

lib/aws/client.ex

+1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ defmodule AWS.Client do
33
secret_access_key: nil,
44
session_token: nil,
55
region: nil,
6+
endpoint: nil,
67
service: nil
78
end

lib/aws/cloudhsm.ex

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
2+
# See https://github.com/jkakar/aws-codegen for more details.
3+
4+
defmodule AWS.CloudHSM do
5+
@moduledoc """
6+
7+
"""
8+
9+
@doc """
10+
Creates a high-availability partition group. A high-availability partition
11+
group is a group of partitions that spans multiple physical HSMs.
12+
"""
13+
def create_hapg(client, input, options \\ []) do
14+
request(client, "CreateHapg", input, options)
15+
end
16+
17+
@doc """
18+
Creates an uninitialized HSM instance. Running this command provisions an
19+
HSM appliance and will result in charges to your AWS account for the HSM.
20+
"""
21+
def create_hsm(client, input, options \\ []) do
22+
request(client, "CreateHsm", input, options)
23+
end
24+
25+
@doc """
26+
Creates an HSM client.
27+
"""
28+
def create_luna_client(client, input, options \\ []) do
29+
request(client, "CreateLunaClient", input, options)
30+
end
31+
32+
@doc """
33+
Deletes a high-availability partition group.
34+
"""
35+
def delete_hapg(client, input, options \\ []) do
36+
request(client, "DeleteHapg", input, options)
37+
end
38+
39+
@doc """
40+
Deletes an HSM. Once complete, this operation cannot be undone and your key
41+
material cannot be recovered.
42+
"""
43+
def delete_hsm(client, input, options \\ []) do
44+
request(client, "DeleteHsm", input, options)
45+
end
46+
47+
@doc """
48+
Deletes a client.
49+
"""
50+
def delete_luna_client(client, input, options \\ []) do
51+
request(client, "DeleteLunaClient", input, options)
52+
end
53+
54+
@doc """
55+
Retrieves information about a high-availability partition group.
56+
"""
57+
def describe_hapg(client, input, options \\ []) do
58+
request(client, "DescribeHapg", input, options)
59+
end
60+
61+
@doc """
62+
Retrieves information about an HSM. You can identify the HSM by its ARN or
63+
its serial number.
64+
"""
65+
def describe_hsm(client, input, options \\ []) do
66+
request(client, "DescribeHsm", input, options)
67+
end
68+
69+
@doc """
70+
Retrieves information about an HSM client.
71+
"""
72+
def describe_luna_client(client, input, options \\ []) do
73+
request(client, "DescribeLunaClient", input, options)
74+
end
75+
76+
@doc """
77+
Gets the configuration files necessary to connect to all high availability
78+
partition groups the client is associated with.
79+
"""
80+
def get_config(client, input, options \\ []) do
81+
request(client, "GetConfig", input, options)
82+
end
83+
84+
@doc """
85+
Lists the Availability Zones that have available AWS CloudHSM capacity.
86+
"""
87+
def list_available_zones(client, input, options \\ []) do
88+
request(client, "ListAvailableZones", input, options)
89+
end
90+
91+
@doc """
92+
Lists the high-availability partition groups for the account.
93+
94+
This operation supports pagination with the use of the *NextToken* member.
95+
If more results are available, the *NextToken* member of the response
96+
contains a token that you pass in the next call to `ListHapgs` to retrieve
97+
the next set of items.
98+
"""
99+
def list_hapgs(client, input, options \\ []) do
100+
request(client, "ListHapgs", input, options)
101+
end
102+
103+
@doc """
104+
Retrieves the identifiers of all of the HSMs provisioned for the current
105+
customer.
106+
107+
This operation supports pagination with the use of the *NextToken* member.
108+
If more results are available, the *NextToken* member of the response
109+
contains a token that you pass in the next call to `ListHsms` to retrieve
110+
the next set of items.
111+
"""
112+
def list_hsms(client, input, options \\ []) do
113+
request(client, "ListHsms", input, options)
114+
end
115+
116+
@doc """
117+
Lists all of the clients.
118+
119+
This operation supports pagination with the use of the *NextToken* member.
120+
If more results are available, the *NextToken* member of the response
121+
contains a token that you pass in the next call to `ListLunaClients` to
122+
retrieve the next set of items.
123+
"""
124+
def list_luna_clients(client, input, options \\ []) do
125+
request(client, "ListLunaClients", input, options)
126+
end
127+
128+
@doc """
129+
Modifies an existing high-availability partition group.
130+
"""
131+
def modify_hapg(client, input, options \\ []) do
132+
request(client, "ModifyHapg", input, options)
133+
end
134+
135+
@doc """
136+
Modifies an HSM.
137+
"""
138+
def modify_hsm(client, input, options \\ []) do
139+
request(client, "ModifyHsm", input, options)
140+
end
141+
142+
@doc """
143+
Modifies the certificate used by the client.
144+
145+
This action can potentially start a workflow to install the new certificate
146+
on the client's HSMs.
147+
"""
148+
def modify_luna_client(client, input, options \\ []) do
149+
request(client, "ModifyLunaClient", input, options)
150+
end
151+
152+
defp request(client, action, input, options) do
153+
client = %{client | service: "cloudhsm"}
154+
host = "cloudhsm.#{client.region}.#{client.endpoint}"
155+
url = "https://#{host}/"
156+
headers = [{"Host", host},
157+
{"Content-Type", "application/x-amz-json-1.1"},
158+
{"X-Amz-Target", "CloudHsmFrontendService.#{action}"}]
159+
payload = Poison.Encoder.encode(input, [])
160+
headers = AWS.Request.sign_v4(client, "POST", url, headers, payload)
161+
case HTTPoison.post(url, payload, headers, options) do
162+
{:ok, response=%HTTPoison.Response{status_code: 200, body: body}} ->
163+
{:ok, Poison.Parser.parse!(body), response}
164+
{:ok, _response=%HTTPoison.Response{body: body}} ->
165+
reason = Poison.Parser.parse!(body)["__type"]
166+
{:error, reason}
167+
{:error, %HTTPoison.Error{reason: reason}} ->
168+
{:error, %HTTPoison.Error{reason: reason}}
169+
end
170+
end
171+
end
172+

lib/aws/cloudtrail.ex

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# WARNING: DO NOT EDIT, AUTO-GENERATED CODE!
2+
# See https://github.com/jkakar/aws-codegen for more details.
3+
4+
defmodule AWS.CloudTrail do
5+
@moduledoc """
6+
This is the CloudTrail API Reference. It provides descriptions of actions,
7+
data types, common parameters, and common errors for CloudTrail.
8+
9+
CloudTrail is a web service that records AWS API calls for your AWS account
10+
and delivers log files to an Amazon S3 bucket. The recorded information
11+
includes the identity of the user, the start time of the AWS API call, the
12+
source IP address, the request parameters, and the response elements
13+
returned by the service.
14+
15+
<note> As an alternative to using the API, you can use one of the AWS SDKs,
16+
which consist of libraries and sample code for various programming
17+
languages and platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs
18+
provide a convenient way to create programmatic access to AWSCloudTrail.
19+
For example, the SDKs take care of cryptographically signing requests,
20+
managing errors, and retrying requests automatically. For information about
21+
the AWS SDKs, including how to download and install them, see the [Tools
22+
for Amazon Web Services page](http://aws.amazon.com/tools/). </note> See
23+
the CloudTrail User Guide for information about the data that is included
24+
with each AWS API call listed in the log files.
25+
"""
26+
27+
@doc """
28+
From the command line, use `create-subscription`.
29+
30+
Creates a trail that specifies the settings for delivery of log data to an
31+
Amazon S3 bucket.
32+
"""
33+
def create_trail(client, input, options \\ []) do
34+
request(client, "CreateTrail", input, options)
35+
end
36+
37+
@doc """
38+
Deletes a trail.
39+
"""
40+
def delete_trail(client, input, options \\ []) do
41+
request(client, "DeleteTrail", input, options)
42+
end
43+
44+
@doc """
45+
Retrieves settings for the trail associated with the current region for
46+
your account.
47+
"""
48+
def describe_trails(client, input, options \\ []) do
49+
request(client, "DescribeTrails", input, options)
50+
end
51+
52+
@doc """
53+
Returns a JSON-formatted list of information about the specified trail.
54+
Fields include information on delivery errors, Amazon SNS and Amazon S3
55+
errors, and start and stop logging times for each trail.
56+
"""
57+
def get_trail_status(client, input, options \\ []) do
58+
request(client, "GetTrailStatus", input, options)
59+
end
60+
61+
@doc """
62+
Looks up API activity events captured by CloudTrail that create, update, or
63+
delete resources in your account. Events for a region can be looked up for
64+
the times in which you had CloudTrail turned on in that region during the
65+
last seven days. Lookup supports five different attributes: time range
66+
(defined by a start time and end time), user name, event name, resource
67+
type, and resource name. All attributes are optional. The maximum number of
68+
attributes that can be specified in any one lookup request are time range
69+
and one other attribute. The default number of results returned is 10, with
70+
a maximum of 50 possible. The response includes a token that you can use to
71+
get the next page of results. The rate of lookup requests is limited to one
72+
per second per account.
73+
74+
<important>Events that occurred during the selected time range will not be
75+
available for lookup if CloudTrail logging was not enabled when the events
76+
occurred.</important>
77+
"""
78+
def lookup_events(client, input, options \\ []) do
79+
request(client, "LookupEvents", input, options)
80+
end
81+
82+
@doc """
83+
Starts the recording of AWS API calls and log file delivery for a trail.
84+
"""
85+
def start_logging(client, input, options \\ []) do
86+
request(client, "StartLogging", input, options)
87+
end
88+
89+
@doc """
90+
Suspends the recording of AWS API calls and log file delivery for the
91+
specified trail. Under most circumstances, there is no need to use this
92+
action. You can update a trail without stopping it first. This action is
93+
the only way to stop recording.
94+
"""
95+
def stop_logging(client, input, options \\ []) do
96+
request(client, "StopLogging", input, options)
97+
end
98+
99+
@doc """
100+
From the command line, use `update-subscription`.
101+
102+
Updates the settings that specify delivery of log files. Changes to a trail
103+
do not require stopping the CloudTrail service. Use this action to
104+
designate an existing bucket for log delivery. If the existing bucket has
105+
previously been a target for CloudTrail log files, an IAM policy exists for
106+
the bucket.
107+
"""
108+
def update_trail(client, input, options \\ []) do
109+
request(client, "UpdateTrail", input, options)
110+
end
111+
112+
defp request(client, action, input, options) do
113+
client = %{client | service: "cloudtrail"}
114+
host = "cloudtrail.#{client.region}.#{client.endpoint}"
115+
url = "https://#{host}/"
116+
headers = [{"Host", host},
117+
{"Content-Type", "application/x-amz-json-1.1"},
118+
{"X-Amz-Target", "com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101.#{action}"}]
119+
payload = Poison.Encoder.encode(input, [])
120+
headers = AWS.Request.sign_v4(client, "POST", url, headers, payload)
121+
case HTTPoison.post(url, payload, headers, options) do
122+
{:ok, response=%HTTPoison.Response{status_code: 200, body: body}} ->
123+
{:ok, Poison.Parser.parse!(body), response}
124+
{:ok, _response=%HTTPoison.Response{body: body}} ->
125+
reason = Poison.Parser.parse!(body)["__type"]
126+
{:error, reason}
127+
{:error, %HTTPoison.Error{reason: reason}} ->
128+
{:error, %HTTPoison.Error{reason: reason}}
129+
end
130+
end
131+
end
132+

0 commit comments

Comments
 (0)