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\Apigee\Resource;
19
20use Google\Service\Apigee\GoogleApiHttpBody;
21use Google\Service\Apigee\GoogleCloudApigeeV1Alias;
22
23/**
24 * The "aliases" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $apigeeService = new Google\Service\Apigee(...);
28 *   $aliases = $apigeeService->aliases;
29 *  </code>
30 */
31class OrganizationsEnvironmentsKeystoresAliases extends \Google\Service\Resource
32{
33  /**
34   * Creates an alias from a key/certificate pair. The structure of the request is
35   * controlled by the `format` query parameter: - `keycertfile` - Separate PEM-
36   * encoded key and certificate files are uploaded. Set `Content-Type: multipart
37   * /form-data` and include the `keyFile`, `certFile`, and `password` (if keys
38   * are encrypted) fields in the request body. If uploading to a truststore, omit
39   * `keyFile`. - `pkcs12` - A PKCS12 file is uploaded. Set `Content-Type:
40   * multipart/form-data`, provide the file in the `file` field, and include the
41   * `password` field if the file is encrypted in the request body. -
42   * `selfsignedcert` - A new private key and certificate are generated. Set
43   * `Content-Type: application/json` and include CertificateGenerationSpec in the
44   * request body. (aliases.create)
45   *
46   * @param string $parent Required. Name of the keystore. Use the following
47   * format in your request:
48   * `organizations/{org}/environments/{env}/keystores/{keystore}`.
49   * @param GoogleApiHttpBody $postBody
50   * @param array $optParams Optional parameters.
51   *
52   * @opt_param string _password DEPRECATED: For improved security, specify the
53   * password in the request body instead of using the query parameter. To specify
54   * the password in the request body, set `Content-type: multipart/form-data`
55   * part with name `password`. Password for the private key file, if required.
56   * @opt_param string alias Alias for the key/certificate pair. Values must match
57   * the regular expression `[\w\s-.]{1,255}`. This must be provided for all
58   * formats except `selfsignedcert`; self-signed certs may specify the alias in
59   * either this parameter or the JSON body.
60   * @opt_param string format Required. Format of the data. Valid values include:
61   * `selfsignedcert`, `keycertfile`, or `pkcs12`
62   * @opt_param bool ignoreExpiryValidation Flag that specifies whether to ignore
63   * expiry validation. If set to `true`, no expiry validation will be performed.
64   * @opt_param bool ignoreNewlineValidation Flag that specifies whether to ignore
65   * newline validation. If set to `true`, no error is thrown when the file
66   * contains a certificate chain with no newline between each certificate.
67   * Defaults to `false`.
68   * @return GoogleCloudApigeeV1Alias
69   */
70  public function create($parent, GoogleApiHttpBody $postBody, $optParams = [])
71  {
72    $params = ['parent' => $parent, 'postBody' => $postBody];
73    $params = array_merge($params, $optParams);
74    return $this->call('create', [$params], GoogleCloudApigeeV1Alias::class);
75  }
76  /**
77   * Generates a PKCS #10 Certificate Signing Request for the private key in an
78   * alias. (aliases.csr)
79   *
80   * @param string $name Required. Name of the alias. Use the following format in
81   * your request: `organizations/{org}/environments/{env}/keystores/{keystore}/al
82   * iases/{alias}`.
83   * @param array $optParams Optional parameters.
84   * @return GoogleApiHttpBody
85   */
86  public function csr($name, $optParams = [])
87  {
88    $params = ['name' => $name];
89    $params = array_merge($params, $optParams);
90    return $this->call('csr', [$params], GoogleApiHttpBody::class);
91  }
92  /**
93   * Deletes an alias. (aliases.delete)
94   *
95   * @param string $name Required. Name of the alias. Use the following format in
96   * your request: `organizations/{org}/environments/{env}/keystores/{keystore}/al
97   * iases/{alias}`.
98   * @param array $optParams Optional parameters.
99   * @return GoogleCloudApigeeV1Alias
100   */
101  public function delete($name, $optParams = [])
102  {
103    $params = ['name' => $name];
104    $params = array_merge($params, $optParams);
105    return $this->call('delete', [$params], GoogleCloudApigeeV1Alias::class);
106  }
107  /**
108   * Gets an alias. (aliases.get)
109   *
110   * @param string $name Required. Name of the alias. Use the following format in
111   * your request: `organizations/{org}/environments/{env}/keystores/{keystore}/al
112   * iases/{alias}`.
113   * @param array $optParams Optional parameters.
114   * @return GoogleCloudApigeeV1Alias
115   */
116  public function get($name, $optParams = [])
117  {
118    $params = ['name' => $name];
119    $params = array_merge($params, $optParams);
120    return $this->call('get', [$params], GoogleCloudApigeeV1Alias::class);
121  }
122  /**
123   * Gets the certificate from an alias in PEM-encoded form.
124   * (aliases.getCertificate)
125   *
126   * @param string $name Required. Name of the alias. Use the following format in
127   * your request: `organizations/{org}/environments/{env}/keystores/{keystore}/al
128   * iases/{alias}`.
129   * @param array $optParams Optional parameters.
130   * @return GoogleApiHttpBody
131   */
132  public function getCertificate($name, $optParams = [])
133  {
134    $params = ['name' => $name];
135    $params = array_merge($params, $optParams);
136    return $this->call('getCertificate', [$params], GoogleApiHttpBody::class);
137  }
138  /**
139   * Updates the certificate in an alias. (aliases.update)
140   *
141   * @param string $name Required. Name of the alias. Use the following format in
142   * your request:
143   * `organizations/{org}/environments/{env}/keystores/{keystore}/aliases/{alias}`
144   * @param GoogleApiHttpBody $postBody
145   * @param array $optParams Optional parameters.
146   *
147   * @opt_param bool ignoreExpiryValidation Required. Flag that specifies whether
148   * to ignore expiry validation. If set to `true`, no expiry validation will be
149   * performed.
150   * @opt_param bool ignoreNewlineValidation Flag that specifies whether to ignore
151   * newline validation. If set to `true`, no error is thrown when the file
152   * contains a certificate chain with no newline between each certificate.
153   * Defaults to `false`.
154   * @return GoogleCloudApigeeV1Alias
155   */
156  public function update($name, GoogleApiHttpBody $postBody, $optParams = [])
157  {
158    $params = ['name' => $name, 'postBody' => $postBody];
159    $params = array_merge($params, $optParams);
160    return $this->call('update', [$params], GoogleCloudApigeeV1Alias::class);
161  }
162}
163
164// Adding a class alias for backwards compatibility with the previous class name.
165class_alias(OrganizationsEnvironmentsKeystoresAliases::class, 'Google_Service_Apigee_Resource_OrganizationsEnvironmentsKeystoresAliases');
166