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\GoogleCloudApigeeV1Attributes;
21use Google\Service\Apigee\GoogleCloudApigeeV1DeveloperApp;
22use Google\Service\Apigee\GoogleCloudApigeeV1ListDeveloperAppsResponse;
23
24/**
25 * The "apps" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $apigeeService = new Google\Service\Apigee(...);
29 *   $apps = $apigeeService->apps;
30 *  </code>
31 */
32class OrganizationsDevelopersApps extends \Google\Service\Resource
33{
34  /**
35   * Updates attributes for a developer app. This API replaces the current
36   * attributes with those specified in the request. (apps.attributes)
37   *
38   * @param string $name Required. Name of the developer app. Use the following
39   * structure in your request:
40   * `organizations/{org}/developers/{developer_email}/apps/{app}`
41   * @param GoogleCloudApigeeV1Attributes $postBody
42   * @param array $optParams Optional parameters.
43   * @return GoogleCloudApigeeV1Attributes
44   */
45  public function attributes($name, GoogleCloudApigeeV1Attributes $postBody, $optParams = [])
46  {
47    $params = ['name' => $name, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('attributes', [$params], GoogleCloudApigeeV1Attributes::class);
50  }
51  /**
52   * Creates an app associated with a developer. This API associates the developer
53   * app with the specified API product and auto-generates an API key for the app
54   * to use in calls to API proxies inside that API product. The `name` is the
55   * unique ID of the app that you can use in API calls. The `DisplayName` (set as
56   * an attribute) appears in the UI. If you don't set the `DisplayName`
57   * attribute, the `name` appears in the UI. (apps.create)
58   *
59   * @param string $parent Required. Name of the developer. Use the following
60   * structure in your request: `organizations/{org}/developers/{developer_email}`
61   * @param GoogleCloudApigeeV1DeveloperApp $postBody
62   * @param array $optParams Optional parameters.
63   * @return GoogleCloudApigeeV1DeveloperApp
64   */
65  public function create($parent, GoogleCloudApigeeV1DeveloperApp $postBody, $optParams = [])
66  {
67    $params = ['parent' => $parent, 'postBody' => $postBody];
68    $params = array_merge($params, $optParams);
69    return $this->call('create', [$params], GoogleCloudApigeeV1DeveloperApp::class);
70  }
71  /**
72   * Deletes a developer app. **Note**: The delete operation is asynchronous. The
73   * developer app is deleted immediately, but its associated resources, such as
74   * app keys or access tokens, may take anywhere from a few seconds to a few
75   * minutes to be deleted. (apps.delete)
76   *
77   * @param string $name Required. Name of the developer app. Use the following
78   * structure in your request:
79   * `organizations/{org}/developers/{developer_email}/apps/{app}`
80   * @param array $optParams Optional parameters.
81   * @return GoogleCloudApigeeV1DeveloperApp
82   */
83  public function delete($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('delete', [$params], GoogleCloudApigeeV1DeveloperApp::class);
88  }
89  /**
90   * Manages access to a developer app by enabling you to: * Approve or revoke a
91   * developer app * Generate a new consumer key and secret for a developer app To
92   * approve or revoke a developer app, set the `action` query parameter to
93   * `approved` or `revoked`, respectively, and the `Content-Type` header to
94   * `application/octet-stream`. If a developer app is revoked, none of its API
95   * keys are valid for API calls even though the keys are still `approved`. If
96   * successful, the API call returns the following HTTP status code: `204 No
97   * Content` To generate a new consumer key and secret for a developer app, pass
98   * the new key/secret details. Rather than replace an existing key, this API
99   * generates a new key. In this case, multiple key pairs may be associated with
100   * a single developer app. Each key pair has an independent status (`approved`
101   * or `revoked`) and expiration time. Any approved, non-expired key can be used
102   * in an API call. For example, if you're using API key rotation, you can
103   * generate new keys with expiration times that overlap keys that are going to
104   * expire. You might also generate a new consumer key/secret if the security of
105   * the original key/secret is compromised. The `keyExpiresIn` property defines
106   * the expiration time for the API key in milliseconds. If you don't set this
107   * property or set it to `-1`, the API key never expires. **Notes**: * When
108   * generating a new key/secret, this API replaces the existing attributes,
109   * notes, and callback URLs with those specified in the request. Include or
110   * exclude any existing information that you want to retain or delete,
111   * respectively. * To migrate existing consumer keys and secrets to hybrid from
112   * another system, see the CreateDeveloperAppKey API.
113   * (apps.generateKeyPairOrUpdateDeveloperAppStatus)
114   *
115   * @param string $name Required. Name of the developer app. Use the following
116   * structure in your request:
117   * `organizations/{org}/developers/{developer_email}/apps/{app}`
118   * @param GoogleCloudApigeeV1DeveloperApp $postBody
119   * @param array $optParams Optional parameters.
120   *
121   * @opt_param string action Action. Valid values are `approve` or `revoke`.
122   * @return GoogleCloudApigeeV1DeveloperApp
123   */
124  public function generateKeyPairOrUpdateDeveloperAppStatus($name, GoogleCloudApigeeV1DeveloperApp $postBody, $optParams = [])
125  {
126    $params = ['name' => $name, 'postBody' => $postBody];
127    $params = array_merge($params, $optParams);
128    return $this->call('generateKeyPairOrUpdateDeveloperAppStatus', [$params], GoogleCloudApigeeV1DeveloperApp::class);
129  }
130  /**
131   * Returns the details for a developer app. (apps.get)
132   *
133   * @param string $name Required. Name of the developer app. Use the following
134   * structure in your request:
135   * `organizations/{org}/developers/{developer_email}/apps/{app}`
136   * @param array $optParams Optional parameters.
137   *
138   * @opt_param string entity **Note**: Must be used in conjunction with the
139   * `query` parameter. Set to `apiresources` to return the number of API
140   * resources that have been approved for access by a developer app in the
141   * specified Apigee organization.
142   * @opt_param string query **Note**: Must be used in conjunction with the
143   * `entity` parameter. Set to `count` to return the number of API resources that
144   * have been approved for access by a developer app in the specified Apigee
145   * organization.
146   * @return GoogleCloudApigeeV1DeveloperApp
147   */
148  public function get($name, $optParams = [])
149  {
150    $params = ['name' => $name];
151    $params = array_merge($params, $optParams);
152    return $this->call('get', [$params], GoogleCloudApigeeV1DeveloperApp::class);
153  }
154  /**
155   * Lists all apps created by a developer in an Apigee organization. Optionally,
156   * you can request an expanded view of the developer apps. A maximum of 100
157   * developer apps are returned per API call. You can paginate the list of
158   * deveoper apps returned using the `startKey` and `count` query parameters.
159   * (apps.listOrganizationsDevelopersApps)
160   *
161   * @param string $parent Required. Name of the developer. Use the following
162   * structure in your request: `organizations/{org}/developers/{developer_email}`
163   * @param array $optParams Optional parameters.
164   *
165   * @opt_param string count Number of developer apps to return in the API call.
166   * Use with the `startKey` parameter to provide more targeted filtering. The
167   * limit is 1000.
168   * @opt_param bool expand Optional. Specifies whether to expand the results. Set
169   * to `true` to expand the results. This query parameter is not valid if you use
170   * the `count` or `startKey` query parameters.
171   * @opt_param bool shallowExpand Optional. Specifies whether to expand the
172   * results in shallow mode. Set to `true` to expand the results in shallow mode.
173   * @opt_param string startKey **Note**: Must be used in conjunction with the
174   * `count` parameter. Name of the developer app from which to start displaying
175   * the list of developer apps. For example, if you're returning 50 developer
176   * apps at a time (using the `count` query parameter), you can view developer
177   * apps 50-99 by entering the name of the 50th developer app. The developer app
178   * name is case sensitive.
179   * @return GoogleCloudApigeeV1ListDeveloperAppsResponse
180   */
181  public function listOrganizationsDevelopersApps($parent, $optParams = [])
182  {
183    $params = ['parent' => $parent];
184    $params = array_merge($params, $optParams);
185    return $this->call('list', [$params], GoogleCloudApigeeV1ListDeveloperAppsResponse::class);
186  }
187  /**
188   * Updates the details for a developer app. In addition, you can add an API
189   * product to a developer app and automatically generate an API key for the app
190   * to use when calling APIs in the API product. If you want to use an existing
191   * API key for the API product, add the API product to the API key using the
192   * UpdateDeveloperAppKey API. Using this API, you cannot update the following: *
193   * App name as it is the primary key used to identify the app and cannot be
194   * changed. * Scopes associated with the app. Instead, use the
195   * ReplaceDeveloperAppKey API. This API replaces the existing attributes with
196   * those specified in the request. Include or exclude any existing attributes
197   * that you want to retain or delete, respectively. (apps.update)
198   *
199   * @param string $name Required. Name of the developer app. Use the following
200   * structure in your request:
201   * `organizations/{org}/developers/{developer_email}/apps/{app}`
202   * @param GoogleCloudApigeeV1DeveloperApp $postBody
203   * @param array $optParams Optional parameters.
204   * @return GoogleCloudApigeeV1DeveloperApp
205   */
206  public function update($name, GoogleCloudApigeeV1DeveloperApp $postBody, $optParams = [])
207  {
208    $params = ['name' => $name, 'postBody' => $postBody];
209    $params = array_merge($params, $optParams);
210    return $this->call('update', [$params], GoogleCloudApigeeV1DeveloperApp::class);
211  }
212}
213
214// Adding a class alias for backwards compatibility with the previous class name.
215class_alias(OrganizationsDevelopersApps::class, 'Google_Service_Apigee_Resource_OrganizationsDevelopersApps');
216