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\GoogleCloudApigeeV1DeveloperAppKey;
21
22/**
23 * The "keys" collection of methods.
24 * Typical usage is:
25 *  <code>
26 *   $apigeeService = new Google\Service\Apigee(...);
27 *   $keys = $apigeeService->keys;
28 *  </code>
29 */
30class OrganizationsDevelopersAppsKeys extends \Google\Service\Resource
31{
32  /**
33   * Creates a custom consumer key and secret for a developer app. This is
34   * particularly useful if you want to migrate existing consumer keys and secrets
35   * to Apigee from another system. Consumer keys and secrets can contain letters,
36   * numbers, underscores, and hyphens. No other special characters are allowed.
37   * To avoid service disruptions, a consumer key and secret should not exceed 2
38   * KBs each. **Note**: When creating the consumer key and secret, an association
39   * to API products will not be made. Therefore, you should not specify the
40   * associated API products in your request. Instead, use the
41   * UpdateDeveloperAppKey API to make the association after the consumer key and
42   * secret are created. If a consumer key and secret already exist, you can keep
43   * them or delete them using the DeleteDeveloperAppKey API. (keys.create)
44   *
45   * @param string $parent Parent of the developer app key. Use the following
46   * structure in your request:
47   * `organizations/{org}/developers/{developer_email}/apps`
48   * @param GoogleCloudApigeeV1DeveloperAppKey $postBody
49   * @param array $optParams Optional parameters.
50   * @return GoogleCloudApigeeV1DeveloperAppKey
51   */
52  public function create($parent, GoogleCloudApigeeV1DeveloperAppKey $postBody, $optParams = [])
53  {
54    $params = ['parent' => $parent, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('create', [$params], GoogleCloudApigeeV1DeveloperAppKey::class);
57  }
58  /**
59   * Deletes an app's consumer key and removes all API products associated with
60   * the app. After the consumer key is deleted, it cannot be used to access any
61   * APIs. **Note**: After you delete a consumer key, you may want to: 1. Create a
62   * new consumer key and secret for the developer app using the
63   * CreateDeveloperAppKey API, and subsequently add an API product to the key
64   * using the UpdateDeveloperAppKey API. 2. Delete the developer app, if it is no
65   * longer required. (keys.delete)
66   *
67   * @param string $name Name of the developer app key. Use the following
68   * structure in your request:
69   * `organizations/{org}/developers/{developer_email}/apps/{app}/keys/{key}`
70   * @param array $optParams Optional parameters.
71   * @return GoogleCloudApigeeV1DeveloperAppKey
72   */
73  public function delete($name, $optParams = [])
74  {
75    $params = ['name' => $name];
76    $params = array_merge($params, $optParams);
77    return $this->call('delete', [$params], GoogleCloudApigeeV1DeveloperAppKey::class);
78  }
79  /**
80   * Gets details for a consumer key for a developer app, including the key and
81   * secret value, associated API products, and other information. (keys.get)
82   *
83   * @param string $name Name of the developer app key. Use the following
84   * structure in your request:
85   * `organizations/{org}/developers/{developer_email}/apps/{app}/keys/{key}`
86   * @param array $optParams Optional parameters.
87   * @return GoogleCloudApigeeV1DeveloperAppKey
88   */
89  public function get($name, $optParams = [])
90  {
91    $params = ['name' => $name];
92    $params = array_merge($params, $optParams);
93    return $this->call('get', [$params], GoogleCloudApigeeV1DeveloperAppKey::class);
94  }
95  /**
96   * Updates the scope of an app. This API replaces the existing scopes with those
97   * specified in the request. Include or exclude any existing scopes that you
98   * want to retain or delete, respectively. The specified scopes must already be
99   * defined for the API products associated with the app. This API sets the
100   * `scopes` element under the `apiProducts` element in the attributes of the
101   * app. (keys.replaceDeveloperAppKey)
102   *
103   * @param string $name Name of the developer app key. Use the following
104   * structure in your request:
105   * `organizations/{org}/developers/{developer_email}/apps/{app}/keys/{key}`
106   * @param GoogleCloudApigeeV1DeveloperAppKey $postBody
107   * @param array $optParams Optional parameters.
108   * @return GoogleCloudApigeeV1DeveloperAppKey
109   */
110  public function replaceDeveloperAppKey($name, GoogleCloudApigeeV1DeveloperAppKey $postBody, $optParams = [])
111  {
112    $params = ['name' => $name, 'postBody' => $postBody];
113    $params = array_merge($params, $optParams);
114    return $this->call('replaceDeveloperAppKey', [$params], GoogleCloudApigeeV1DeveloperAppKey::class);
115  }
116  /**
117   * Adds an API product to a developer app key, enabling the app that holds the
118   * key to access the API resources bundled in the API product. In addition, you
119   * can add attributes to a developer app key. This API replaces the existing
120   * attributes with those specified in the request. Include or exclude any
121   * existing attributes that you want to retain or delete, respectively. You can
122   * use the same key to access all API products associated with the app.
123   * (keys.updateDeveloperAppKey)
124   *
125   * @param string $name Name of the developer app key. Use the following
126   * structure in your request:
127   * `organizations/{org}/developers/{developer_email}/apps/{app}/keys/{key}`
128   * @param GoogleCloudApigeeV1DeveloperAppKey $postBody
129   * @param array $optParams Optional parameters.
130   *
131   * @opt_param string action Approve or revoke the consumer key by setting this
132   * value to `approve` or `revoke`, respectively. The `Content-Type` header must
133   * be set to `application/octet-stream`.
134   * @return GoogleCloudApigeeV1DeveloperAppKey
135   */
136  public function updateDeveloperAppKey($name, GoogleCloudApigeeV1DeveloperAppKey $postBody, $optParams = [])
137  {
138    $params = ['name' => $name, 'postBody' => $postBody];
139    $params = array_merge($params, $optParams);
140    return $this->call('updateDeveloperAppKey', [$params], GoogleCloudApigeeV1DeveloperAppKey::class);
141  }
142}
143
144// Adding a class alias for backwards compatibility with the previous class name.
145class_alias(OrganizationsDevelopersAppsKeys::class, 'Google_Service_Apigee_Resource_OrganizationsDevelopersAppsKeys');
146