|
| 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 | + |
0 commit comments