[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\CloudKMS\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\CloudKMS\CryptoKey;
|
---|
| 21 | use Google\Service\CloudKMS\DecryptRequest;
|
---|
| 22 | use Google\Service\CloudKMS\DecryptResponse;
|
---|
| 23 | use Google\Service\CloudKMS\EncryptRequest;
|
---|
| 24 | use Google\Service\CloudKMS\EncryptResponse;
|
---|
| 25 | use Google\Service\CloudKMS\ListCryptoKeysResponse;
|
---|
| 26 | use Google\Service\CloudKMS\Policy;
|
---|
| 27 | use Google\Service\CloudKMS\SetIamPolicyRequest;
|
---|
| 28 | use Google\Service\CloudKMS\TestIamPermissionsRequest;
|
---|
| 29 | use Google\Service\CloudKMS\TestIamPermissionsResponse;
|
---|
| 30 | use Google\Service\CloudKMS\UpdateCryptoKeyPrimaryVersionRequest;
|
---|
| 31 |
|
---|
| 32 | /**
|
---|
| 33 | * The "cryptoKeys" collection of methods.
|
---|
| 34 | * Typical usage is:
|
---|
| 35 | * <code>
|
---|
| 36 | * $cloudkmsService = new Google\Service\CloudKMS(...);
|
---|
| 37 | * $cryptoKeys = $cloudkmsService->projects_locations_keyRings_cryptoKeys;
|
---|
| 38 | * </code>
|
---|
| 39 | */
|
---|
| 40 | class ProjectsLocationsKeyRingsCryptoKeys extends \Google\Service\Resource
|
---|
| 41 | {
|
---|
| 42 | /**
|
---|
| 43 | * Create a new CryptoKey within a KeyRing. CryptoKey.purpose and
|
---|
| 44 | * CryptoKey.version_template.algorithm are required. (cryptoKeys.create)
|
---|
| 45 | *
|
---|
| 46 | * @param string $parent Required. The name of the KeyRing associated with the
|
---|
| 47 | * CryptoKeys.
|
---|
| 48 | * @param CryptoKey $postBody
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | *
|
---|
| 51 | * @opt_param string cryptoKeyId Required. It must be unique within a KeyRing
|
---|
| 52 | * and match the regular expression `[a-zA-Z0-9_-]{1,63}`
|
---|
| 53 | * @opt_param bool skipInitialVersionCreation If set to true, the request will
|
---|
| 54 | * create a CryptoKey without any CryptoKeyVersions. You must manually call
|
---|
| 55 | * CreateCryptoKeyVersion or ImportCryptoKeyVersion before you can use this
|
---|
| 56 | * CryptoKey.
|
---|
| 57 | * @return CryptoKey
|
---|
| 58 | * @throws \Google\Service\Exception
|
---|
| 59 | */
|
---|
| 60 | public function create($parent, CryptoKey $postBody, $optParams = [])
|
---|
| 61 | {
|
---|
| 62 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 63 | $params = array_merge($params, $optParams);
|
---|
| 64 | return $this->call('create', [$params], CryptoKey::class);
|
---|
| 65 | }
|
---|
| 66 | /**
|
---|
| 67 | * Decrypts data that was protected by Encrypt. The CryptoKey.purpose must be
|
---|
| 68 | * ENCRYPT_DECRYPT. (cryptoKeys.decrypt)
|
---|
| 69 | *
|
---|
| 70 | * @param string $name Required. The resource name of the CryptoKey to use for
|
---|
| 71 | * decryption. The server will choose the appropriate version.
|
---|
| 72 | * @param DecryptRequest $postBody
|
---|
| 73 | * @param array $optParams Optional parameters.
|
---|
| 74 | * @return DecryptResponse
|
---|
| 75 | * @throws \Google\Service\Exception
|
---|
| 76 | */
|
---|
| 77 | public function decrypt($name, DecryptRequest $postBody, $optParams = [])
|
---|
| 78 | {
|
---|
| 79 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 80 | $params = array_merge($params, $optParams);
|
---|
| 81 | return $this->call('decrypt', [$params], DecryptResponse::class);
|
---|
| 82 | }
|
---|
| 83 | /**
|
---|
| 84 | * Encrypts data, so that it can only be recovered by a call to Decrypt. The
|
---|
| 85 | * CryptoKey.purpose must be ENCRYPT_DECRYPT. (cryptoKeys.encrypt)
|
---|
| 86 | *
|
---|
| 87 | * @param string $name Required. The resource name of the CryptoKey or
|
---|
| 88 | * CryptoKeyVersion to use for encryption. If a CryptoKey is specified, the
|
---|
| 89 | * server will use its primary version.
|
---|
| 90 | * @param EncryptRequest $postBody
|
---|
| 91 | * @param array $optParams Optional parameters.
|
---|
| 92 | * @return EncryptResponse
|
---|
| 93 | * @throws \Google\Service\Exception
|
---|
| 94 | */
|
---|
| 95 | public function encrypt($name, EncryptRequest $postBody, $optParams = [])
|
---|
| 96 | {
|
---|
| 97 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 98 | $params = array_merge($params, $optParams);
|
---|
| 99 | return $this->call('encrypt', [$params], EncryptResponse::class);
|
---|
| 100 | }
|
---|
| 101 | /**
|
---|
| 102 | * Returns metadata for a given CryptoKey, as well as its primary
|
---|
| 103 | * CryptoKeyVersion. (cryptoKeys.get)
|
---|
| 104 | *
|
---|
| 105 | * @param string $name Required. The name of the CryptoKey to get.
|
---|
| 106 | * @param array $optParams Optional parameters.
|
---|
| 107 | * @return CryptoKey
|
---|
| 108 | * @throws \Google\Service\Exception
|
---|
| 109 | */
|
---|
| 110 | public function get($name, $optParams = [])
|
---|
| 111 | {
|
---|
| 112 | $params = ['name' => $name];
|
---|
| 113 | $params = array_merge($params, $optParams);
|
---|
| 114 | return $this->call('get', [$params], CryptoKey::class);
|
---|
| 115 | }
|
---|
| 116 | /**
|
---|
| 117 | * Gets the access control policy for a resource. Returns an empty policy if the
|
---|
| 118 | * resource exists and does not have a policy set. (cryptoKeys.getIamPolicy)
|
---|
| 119 | *
|
---|
| 120 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 121 | * requested. See [Resource
|
---|
| 122 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 123 | * appropriate value for this field.
|
---|
| 124 | * @param array $optParams Optional parameters.
|
---|
| 125 | *
|
---|
| 126 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
| 127 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
| 128 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
| 129 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
| 130 | * conditional role bindings may specify any valid value or leave the field
|
---|
| 131 | * unset. The policy in the response might use the policy version that you
|
---|
| 132 | * specified, or it might use a lower policy version. For example, if you
|
---|
| 133 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
| 134 | * response uses version 1. To learn which resources support conditions in their
|
---|
| 135 | * IAM policies, see the [IAM
|
---|
| 136 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
| 137 | * policies).
|
---|
| 138 | * @return Policy
|
---|
| 139 | * @throws \Google\Service\Exception
|
---|
| 140 | */
|
---|
| 141 | public function getIamPolicy($resource, $optParams = [])
|
---|
| 142 | {
|
---|
| 143 | $params = ['resource' => $resource];
|
---|
| 144 | $params = array_merge($params, $optParams);
|
---|
| 145 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 146 | }
|
---|
| 147 | /**
|
---|
| 148 | * Lists CryptoKeys. (cryptoKeys.listProjectsLocationsKeyRingsCryptoKeys)
|
---|
| 149 | *
|
---|
| 150 | * @param string $parent Required. The resource name of the KeyRing to list, in
|
---|
| 151 | * the format `projects/locations/keyRings`.
|
---|
| 152 | * @param array $optParams Optional parameters.
|
---|
| 153 | *
|
---|
| 154 | * @opt_param string filter Optional. Only include resources that match the
|
---|
| 155 | * filter in the response. For more information, see [Sorting and filtering list
|
---|
| 156 | * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
|
---|
| 157 | * @opt_param string orderBy Optional. Specify how the results should be sorted.
|
---|
| 158 | * If not specified, the results will be sorted in the default order. For more
|
---|
| 159 | * information, see [Sorting and filtering list
|
---|
| 160 | * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
|
---|
| 161 | * @opt_param int pageSize Optional. Optional limit on the number of CryptoKeys
|
---|
| 162 | * to include in the response. Further CryptoKeys can subsequently be obtained
|
---|
| 163 | * by including the ListCryptoKeysResponse.next_page_token in a subsequent
|
---|
| 164 | * request. If unspecified, the server will pick an appropriate default.
|
---|
| 165 | * @opt_param string pageToken Optional. Optional pagination token, returned
|
---|
| 166 | * earlier via ListCryptoKeysResponse.next_page_token.
|
---|
| 167 | * @opt_param string versionView The fields of the primary version to include in
|
---|
| 168 | * the response.
|
---|
| 169 | * @return ListCryptoKeysResponse
|
---|
| 170 | * @throws \Google\Service\Exception
|
---|
| 171 | */
|
---|
| 172 | public function listProjectsLocationsKeyRingsCryptoKeys($parent, $optParams = [])
|
---|
| 173 | {
|
---|
| 174 | $params = ['parent' => $parent];
|
---|
| 175 | $params = array_merge($params, $optParams);
|
---|
| 176 | return $this->call('list', [$params], ListCryptoKeysResponse::class);
|
---|
| 177 | }
|
---|
| 178 | /**
|
---|
| 179 | * Update a CryptoKey. (cryptoKeys.patch)
|
---|
| 180 | *
|
---|
| 181 | * @param string $name Output only. The resource name for this CryptoKey in the
|
---|
| 182 | * format `projects/locations/keyRings/cryptoKeys`.
|
---|
| 183 | * @param CryptoKey $postBody
|
---|
| 184 | * @param array $optParams Optional parameters.
|
---|
| 185 | *
|
---|
| 186 | * @opt_param string updateMask Required. List of fields to be updated in this
|
---|
| 187 | * request.
|
---|
| 188 | * @return CryptoKey
|
---|
| 189 | * @throws \Google\Service\Exception
|
---|
| 190 | */
|
---|
| 191 | public function patch($name, CryptoKey $postBody, $optParams = [])
|
---|
| 192 | {
|
---|
| 193 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 194 | $params = array_merge($params, $optParams);
|
---|
| 195 | return $this->call('patch', [$params], CryptoKey::class);
|
---|
| 196 | }
|
---|
| 197 | /**
|
---|
| 198 | * Sets the access control policy on the specified resource. Replaces any
|
---|
| 199 | * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
|
---|
| 200 | * `PERMISSION_DENIED` errors. (cryptoKeys.setIamPolicy)
|
---|
| 201 | *
|
---|
| 202 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 203 | * specified. See [Resource
|
---|
| 204 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 205 | * appropriate value for this field.
|
---|
| 206 | * @param SetIamPolicyRequest $postBody
|
---|
| 207 | * @param array $optParams Optional parameters.
|
---|
| 208 | * @return Policy
|
---|
| 209 | * @throws \Google\Service\Exception
|
---|
| 210 | */
|
---|
| 211 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 212 | {
|
---|
| 213 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 214 | $params = array_merge($params, $optParams);
|
---|
| 215 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 216 | }
|
---|
| 217 | /**
|
---|
| 218 | * Returns permissions that a caller has on the specified resource. If the
|
---|
| 219 | * resource does not exist, this will return an empty set of permissions, not a
|
---|
| 220 | * `NOT_FOUND` error. Note: This operation is designed to be used for building
|
---|
| 221 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
| 222 | * This operation may "fail open" without warning.
|
---|
| 223 | * (cryptoKeys.testIamPermissions)
|
---|
| 224 | *
|
---|
| 225 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
| 226 | * being requested. See [Resource
|
---|
| 227 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 228 | * appropriate value for this field.
|
---|
| 229 | * @param TestIamPermissionsRequest $postBody
|
---|
| 230 | * @param array $optParams Optional parameters.
|
---|
| 231 | * @return TestIamPermissionsResponse
|
---|
| 232 | * @throws \Google\Service\Exception
|
---|
| 233 | */
|
---|
| 234 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
| 235 | {
|
---|
| 236 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 237 | $params = array_merge($params, $optParams);
|
---|
| 238 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
| 239 | }
|
---|
| 240 | /**
|
---|
| 241 | * Update the version of a CryptoKey that will be used in Encrypt. Returns an
|
---|
| 242 | * error if called on a key whose purpose is not ENCRYPT_DECRYPT.
|
---|
| 243 | * (cryptoKeys.updatePrimaryVersion)
|
---|
| 244 | *
|
---|
| 245 | * @param string $name Required. The resource name of the CryptoKey to update.
|
---|
| 246 | * @param UpdateCryptoKeyPrimaryVersionRequest $postBody
|
---|
| 247 | * @param array $optParams Optional parameters.
|
---|
| 248 | * @return CryptoKey
|
---|
| 249 | * @throws \Google\Service\Exception
|
---|
| 250 | */
|
---|
| 251 | public function updatePrimaryVersion($name, UpdateCryptoKeyPrimaryVersionRequest $postBody, $optParams = [])
|
---|
| 252 | {
|
---|
| 253 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 254 | $params = array_merge($params, $optParams);
|
---|
| 255 | return $this->call('updatePrimaryVersion', [$params], CryptoKey::class);
|
---|
| 256 | }
|
---|
| 257 | }
|
---|
| 258 |
|
---|
| 259 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 260 | class_alias(ProjectsLocationsKeyRingsCryptoKeys::class, 'Google_Service_CloudKMS_Resource_ProjectsLocationsKeyRingsCryptoKeys');
|
---|