[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\SecretManager\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\SecretManager\AddSecretVersionRequest;
|
---|
| 21 | use Google\Service\SecretManager\ListSecretsResponse;
|
---|
| 22 | use Google\Service\SecretManager\Policy;
|
---|
| 23 | use Google\Service\SecretManager\Secret;
|
---|
| 24 | use Google\Service\SecretManager\SecretVersion;
|
---|
| 25 | use Google\Service\SecretManager\SecretmanagerEmpty;
|
---|
| 26 | use Google\Service\SecretManager\SetIamPolicyRequest;
|
---|
| 27 | use Google\Service\SecretManager\TestIamPermissionsRequest;
|
---|
| 28 | use Google\Service\SecretManager\TestIamPermissionsResponse;
|
---|
| 29 |
|
---|
| 30 | /**
|
---|
| 31 | * The "secrets" collection of methods.
|
---|
| 32 | * Typical usage is:
|
---|
| 33 | * <code>
|
---|
| 34 | * $secretmanagerService = new Google\Service\SecretManager(...);
|
---|
| 35 | * $secrets = $secretmanagerService->projects_secrets;
|
---|
| 36 | * </code>
|
---|
| 37 | */
|
---|
| 38 | class ProjectsSecrets extends \Google\Service\Resource
|
---|
| 39 | {
|
---|
| 40 | /**
|
---|
| 41 | * Creates a new SecretVersion containing secret data and attaches it to an
|
---|
| 42 | * existing Secret. (secrets.addVersion)
|
---|
| 43 | *
|
---|
| 44 | * @param string $parent Required. The resource name of the Secret to associate
|
---|
| 45 | * with the SecretVersion in the format `projects/secrets` or
|
---|
| 46 | * `projects/locations/secrets`.
|
---|
| 47 | * @param AddSecretVersionRequest $postBody
|
---|
| 48 | * @param array $optParams Optional parameters.
|
---|
| 49 | * @return SecretVersion
|
---|
| 50 | * @throws \Google\Service\Exception
|
---|
| 51 | */
|
---|
| 52 | public function addVersion($parent, AddSecretVersionRequest $postBody, $optParams = [])
|
---|
| 53 | {
|
---|
| 54 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 55 | $params = array_merge($params, $optParams);
|
---|
| 56 | return $this->call('addVersion', [$params], SecretVersion::class);
|
---|
| 57 | }
|
---|
| 58 | /**
|
---|
| 59 | * Creates a new Secret containing no SecretVersions. (secrets.create)
|
---|
| 60 | *
|
---|
| 61 | * @param string $parent Required. The resource name of the project to associate
|
---|
| 62 | * with the Secret, in the format `projects` or `projects/locations`.
|
---|
| 63 | * @param Secret $postBody
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | *
|
---|
| 66 | * @opt_param string secretId Required. This must be unique within the project.
|
---|
| 67 | * A secret ID is a string with a maximum length of 255 characters and can
|
---|
| 68 | * contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and
|
---|
| 69 | * underscore (`_`) characters.
|
---|
| 70 | * @return Secret
|
---|
| 71 | * @throws \Google\Service\Exception
|
---|
| 72 | */
|
---|
| 73 | public function create($parent, Secret $postBody, $optParams = [])
|
---|
| 74 | {
|
---|
| 75 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 76 | $params = array_merge($params, $optParams);
|
---|
| 77 | return $this->call('create', [$params], Secret::class);
|
---|
| 78 | }
|
---|
| 79 | /**
|
---|
| 80 | * Deletes a Secret. (secrets.delete)
|
---|
| 81 | *
|
---|
| 82 | * @param string $name Required. The resource name of the Secret to delete in
|
---|
| 83 | * the format `projects/secrets`.
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | *
|
---|
| 86 | * @opt_param string etag Optional. Etag of the Secret. The request succeeds if
|
---|
| 87 | * it matches the etag of the currently stored secret object. If the etag is
|
---|
| 88 | * omitted, the request succeeds.
|
---|
| 89 | * @return SecretmanagerEmpty
|
---|
| 90 | * @throws \Google\Service\Exception
|
---|
| 91 | */
|
---|
| 92 | public function delete($name, $optParams = [])
|
---|
| 93 | {
|
---|
| 94 | $params = ['name' => $name];
|
---|
| 95 | $params = array_merge($params, $optParams);
|
---|
| 96 | return $this->call('delete', [$params], SecretmanagerEmpty::class);
|
---|
| 97 | }
|
---|
| 98 | /**
|
---|
| 99 | * Gets metadata for a given Secret. (secrets.get)
|
---|
| 100 | *
|
---|
| 101 | * @param string $name Required. The resource name of the Secret, in the format
|
---|
| 102 | * `projects/secrets` or `projects/locations/secrets`.
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return Secret
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function get($name, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['name' => $name];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('get', [$params], Secret::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Gets the access control policy for a secret. Returns empty policy if the
|
---|
| 115 | * secret exists and does not have a policy set. (secrets.getIamPolicy)
|
---|
| 116 | *
|
---|
| 117 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 118 | * requested. See [Resource
|
---|
| 119 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 120 | * appropriate value for this field.
|
---|
| 121 | * @param array $optParams Optional parameters.
|
---|
| 122 | *
|
---|
| 123 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
| 124 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
| 125 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
| 126 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
| 127 | * conditional role bindings may specify any valid value or leave the field
|
---|
| 128 | * unset. The policy in the response might use the policy version that you
|
---|
| 129 | * specified, or it might use a lower policy version. For example, if you
|
---|
| 130 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
| 131 | * response uses version 1. To learn which resources support conditions in their
|
---|
| 132 | * IAM policies, see the [IAM
|
---|
| 133 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
| 134 | * policies).
|
---|
| 135 | * @return Policy
|
---|
| 136 | * @throws \Google\Service\Exception
|
---|
| 137 | */
|
---|
| 138 | public function getIamPolicy($resource, $optParams = [])
|
---|
| 139 | {
|
---|
| 140 | $params = ['resource' => $resource];
|
---|
| 141 | $params = array_merge($params, $optParams);
|
---|
| 142 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 143 | }
|
---|
| 144 | /**
|
---|
| 145 | * Lists Secrets. (secrets.listProjectsSecrets)
|
---|
| 146 | *
|
---|
| 147 | * @param string $parent Required. The resource name of the project associated
|
---|
| 148 | * with the Secrets, in the format `projects` or `projects/locations`
|
---|
| 149 | * @param array $optParams Optional parameters.
|
---|
| 150 | *
|
---|
| 151 | * @opt_param string filter Optional. Filter string, adhering to the rules in
|
---|
| 152 | * [List-operation filtering](https://cloud.google.com/secret-
|
---|
| 153 | * manager/docs/filtering). List only secrets matching the filter. If filter is
|
---|
| 154 | * empty, all secrets are listed.
|
---|
| 155 | * @opt_param int pageSize Optional. The maximum number of results to be
|
---|
| 156 | * returned in a single page. If set to 0, the server decides the number of
|
---|
| 157 | * results to return. If the number is greater than 25000, it is capped at
|
---|
| 158 | * 25000.
|
---|
| 159 | * @opt_param string pageToken Optional. Pagination token, returned earlier via
|
---|
| 160 | * ListSecretsResponse.next_page_token.
|
---|
| 161 | * @return ListSecretsResponse
|
---|
| 162 | * @throws \Google\Service\Exception
|
---|
| 163 | */
|
---|
| 164 | public function listProjectsSecrets($parent, $optParams = [])
|
---|
| 165 | {
|
---|
| 166 | $params = ['parent' => $parent];
|
---|
| 167 | $params = array_merge($params, $optParams);
|
---|
| 168 | return $this->call('list', [$params], ListSecretsResponse::class);
|
---|
| 169 | }
|
---|
| 170 | /**
|
---|
| 171 | * Updates metadata of an existing Secret. (secrets.patch)
|
---|
| 172 | *
|
---|
| 173 | * @param string $name Output only. The resource name of the Secret in the
|
---|
| 174 | * format `projects/secrets`.
|
---|
| 175 | * @param Secret $postBody
|
---|
| 176 | * @param array $optParams Optional parameters.
|
---|
| 177 | *
|
---|
| 178 | * @opt_param string updateMask Required. Specifies the fields to be updated.
|
---|
| 179 | * @return Secret
|
---|
| 180 | * @throws \Google\Service\Exception
|
---|
| 181 | */
|
---|
| 182 | public function patch($name, Secret $postBody, $optParams = [])
|
---|
| 183 | {
|
---|
| 184 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 185 | $params = array_merge($params, $optParams);
|
---|
| 186 | return $this->call('patch', [$params], Secret::class);
|
---|
| 187 | }
|
---|
| 188 | /**
|
---|
| 189 | * Sets the access control policy on the specified secret. Replaces any existing
|
---|
| 190 | * policy. Permissions on SecretVersions are enforced according to the policy
|
---|
| 191 | * set on the associated Secret. (secrets.setIamPolicy)
|
---|
| 192 | *
|
---|
| 193 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 194 | * specified. See [Resource
|
---|
| 195 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 196 | * appropriate value for this field.
|
---|
| 197 | * @param SetIamPolicyRequest $postBody
|
---|
| 198 | * @param array $optParams Optional parameters.
|
---|
| 199 | * @return Policy
|
---|
| 200 | * @throws \Google\Service\Exception
|
---|
| 201 | */
|
---|
| 202 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 203 | {
|
---|
| 204 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 205 | $params = array_merge($params, $optParams);
|
---|
| 206 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 207 | }
|
---|
| 208 | /**
|
---|
| 209 | * Returns permissions that a caller has for the specified secret. If the secret
|
---|
| 210 | * does not exist, this call returns an empty set of permissions, not a
|
---|
| 211 | * NOT_FOUND error. Note: This operation is designed to be used for building
|
---|
| 212 | * permission-aware UIs and command-line tools, not for authorization checking.
|
---|
| 213 | * This operation may "fail open" without warning. (secrets.testIamPermissions)
|
---|
| 214 | *
|
---|
| 215 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
| 216 | * being requested. See [Resource
|
---|
| 217 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 218 | * appropriate value for this field.
|
---|
| 219 | * @param TestIamPermissionsRequest $postBody
|
---|
| 220 | * @param array $optParams Optional parameters.
|
---|
| 221 | * @return TestIamPermissionsResponse
|
---|
| 222 | * @throws \Google\Service\Exception
|
---|
| 223 | */
|
---|
| 224 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
| 225 | {
|
---|
| 226 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 227 | $params = array_merge($params, $optParams);
|
---|
| 228 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
| 229 | }
|
---|
| 230 | }
|
---|
| 231 |
|
---|
| 232 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 233 | class_alias(ProjectsSecrets::class, 'Google_Service_SecretManager_Resource_ProjectsSecrets');
|
---|