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
18namespace Google\Service\SecretManager\Resource;
19
20use Google\Service\SecretManager\AccessSecretVersionResponse;
21use Google\Service\SecretManager\DestroySecretVersionRequest;
22use Google\Service\SecretManager\DisableSecretVersionRequest;
23use Google\Service\SecretManager\EnableSecretVersionRequest;
24use Google\Service\SecretManager\ListSecretVersionsResponse;
25use Google\Service\SecretManager\SecretVersion;
26
27/**
28 * The "versions" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $secretmanagerService = new Google\Service\SecretManager(...);
32 *   $versions = $secretmanagerService->versions;
33 *  </code>
34 */
35class ProjectsSecretsVersions extends \Google\Service\Resource
36{
37  /**
38   * Accesses a SecretVersion. This call returns the secret data.
39   * `projects/secrets/versions/latest` is an alias to the most recently created
40   * SecretVersion. (versions.access)
41   *
42   * @param string $name Required. The resource name of the SecretVersion in the
43   * format `projects/secrets/versions`. `projects/secrets/versions/latest` is an
44   * alias to the most recently created SecretVersion.
45   * @param array $optParams Optional parameters.
46   * @return AccessSecretVersionResponse
47   */
48  public function access($name, $optParams = [])
49  {
50    $params = ['name' => $name];
51    $params = array_merge($params, $optParams);
52    return $this->call('access', [$params], AccessSecretVersionResponse::class);
53  }
54  /**
55   * Destroys a SecretVersion. Sets the state of the SecretVersion to DESTROYED
56   * and irrevocably destroys the secret data. (versions.destroy)
57   *
58   * @param string $name Required. The resource name of the SecretVersion to
59   * destroy in the format `projects/secrets/versions`.
60   * @param DestroySecretVersionRequest $postBody
61   * @param array $optParams Optional parameters.
62   * @return SecretVersion
63   */
64  public function destroy($name, DestroySecretVersionRequest $postBody, $optParams = [])
65  {
66    $params = ['name' => $name, 'postBody' => $postBody];
67    $params = array_merge($params, $optParams);
68    return $this->call('destroy', [$params], SecretVersion::class);
69  }
70  /**
71   * Disables a SecretVersion. Sets the state of the SecretVersion to DISABLED.
72   * (versions.disable)
73   *
74   * @param string $name Required. The resource name of the SecretVersion to
75   * disable in the format `projects/secrets/versions`.
76   * @param DisableSecretVersionRequest $postBody
77   * @param array $optParams Optional parameters.
78   * @return SecretVersion
79   */
80  public function disable($name, DisableSecretVersionRequest $postBody, $optParams = [])
81  {
82    $params = ['name' => $name, 'postBody' => $postBody];
83    $params = array_merge($params, $optParams);
84    return $this->call('disable', [$params], SecretVersion::class);
85  }
86  /**
87   * Enables a SecretVersion. Sets the state of the SecretVersion to ENABLED.
88   * (versions.enable)
89   *
90   * @param string $name Required. The resource name of the SecretVersion to
91   * enable in the format `projects/secrets/versions`.
92   * @param EnableSecretVersionRequest $postBody
93   * @param array $optParams Optional parameters.
94   * @return SecretVersion
95   */
96  public function enable($name, EnableSecretVersionRequest $postBody, $optParams = [])
97  {
98    $params = ['name' => $name, 'postBody' => $postBody];
99    $params = array_merge($params, $optParams);
100    return $this->call('enable', [$params], SecretVersion::class);
101  }
102  /**
103   * Gets metadata for a SecretVersion. `projects/secrets/versions/latest` is an
104   * alias to the most recently created SecretVersion. (versions.get)
105   *
106   * @param string $name Required. The resource name of the SecretVersion in the
107   * format `projects/secrets/versions`. `projects/secrets/versions/latest` is an
108   * alias to the most recently created SecretVersion.
109   * @param array $optParams Optional parameters.
110   * @return SecretVersion
111   */
112  public function get($name, $optParams = [])
113  {
114    $params = ['name' => $name];
115    $params = array_merge($params, $optParams);
116    return $this->call('get', [$params], SecretVersion::class);
117  }
118  /**
119   * Lists SecretVersions. This call does not return secret data.
120   * (versions.listProjectsSecretsVersions)
121   *
122   * @param string $parent Required. The resource name of the Secret associated
123   * with the SecretVersions to list, in the format `projects/secrets`.
124   * @param array $optParams Optional parameters.
125   *
126   * @opt_param string filter Optional. Filter string, adhering to the rules in
127   * [List-operation filtering](https://cloud.google.com/secret-
128   * manager/docs/filtering). List only secret versions matching the filter. If
129   * filter is empty, all secret versions are listed.
130   * @opt_param int pageSize Optional. The maximum number of results to be
131   * returned in a single page. If set to 0, the server decides the number of
132   * results to return. If the number is greater than 25000, it is capped at
133   * 25000.
134   * @opt_param string pageToken Optional. Pagination token, returned earlier via
135   * ListSecretVersionsResponse.next_page_token][].
136   * @return ListSecretVersionsResponse
137   */
138  public function listProjectsSecretsVersions($parent, $optParams = [])
139  {
140    $params = ['parent' => $parent];
141    $params = array_merge($params, $optParams);
142    return $this->call('list', [$params], ListSecretVersionsResponse::class);
143  }
144}
145
146// Adding a class alias for backwards compatibility with the previous class name.
147class_alias(ProjectsSecretsVersions::class, 'Google_Service_SecretManager_Resource_ProjectsSecretsVersions');
148