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\GoogleCloudApigeeV1ApiProduct;
21use Google\Service\Apigee\GoogleCloudApigeeV1Attributes;
22use Google\Service\Apigee\GoogleCloudApigeeV1ListApiProductsResponse;
23
24/**
25 * The "apiproducts" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $apigeeService = new Google\Service\Apigee(...);
29 *   $apiproducts = $apigeeService->apiproducts;
30 *  </code>
31 */
32class OrganizationsApiproducts extends \Google\Service\Resource
33{
34  /**
35   * Updates or creates API product attributes. This API **replaces** the current
36   * list of attributes with the attributes specified in the request body. In this
37   * way, you can update existing attributes, add new attributes, or delete
38   * existing attributes by omitting them from the request body. **Note**: OAuth
39   * access tokens and Key Management Service (KMS) entities (apps, developers,
40   * and API products) are cached for 180 seconds (current default). Any custom
41   * attributes associated with entities also get cached for at least 180 seconds
42   * after entity is accessed during runtime. In this case, the `ExpiresIn`
43   * element on the OAuthV2 policy won't be able to expire an access token in less
44   * than 180 seconds. (apiproducts.attributes)
45   *
46   * @param string $name Required. Name of the API product. Use the following
47   * structure in your request: `organizations/{org}/apiproducts/{apiproduct}`
48   * @param GoogleCloudApigeeV1Attributes $postBody
49   * @param array $optParams Optional parameters.
50   * @return GoogleCloudApigeeV1Attributes
51   */
52  public function attributes($name, GoogleCloudApigeeV1Attributes $postBody, $optParams = [])
53  {
54    $params = ['name' => $name, 'postBody' => $postBody];
55    $params = array_merge($params, $optParams);
56    return $this->call('attributes', [$params], GoogleCloudApigeeV1Attributes::class);
57  }
58  /**
59   * Creates an API product in an organization. You create API products after you
60   * have proxied backend services using API proxies. An API product is a
61   * collection of API resources combined with quota settings and metadata that
62   * you can use to deliver customized and productized API bundles to your
63   * developer community. This metadata can include: - Scope - Environments - API
64   * proxies - Extensible profile API products enable you repackage APIs on the
65   * fly, without having to do any additional coding or configuration. Apigee
66   * recommends that you start with a simple API product including only required
67   * elements. You then provision credentials to apps to enable them to start
68   * testing your APIs. After you have authentication and authorization working
69   * against a simple API product, you can iterate to create finer-grained API
70   * products, defining different sets of API resources for each API product.
71   * **WARNING:** - If you don't specify an API proxy in the request body, *any*
72   * app associated with the product can make calls to *any* API in your entire
73   * organization. - If you don't specify an environment in the request body, the
74   * product allows access to all environments. For more information, see What is
75   * an API product? (apiproducts.create)
76   *
77   * @param string $parent Required. Name of the organization in which the API
78   * product will be created. Use the following structure in your request:
79   * `organizations/{org}`
80   * @param GoogleCloudApigeeV1ApiProduct $postBody
81   * @param array $optParams Optional parameters.
82   * @return GoogleCloudApigeeV1ApiProduct
83   */
84  public function create($parent, GoogleCloudApigeeV1ApiProduct $postBody, $optParams = [])
85  {
86    $params = ['parent' => $parent, 'postBody' => $postBody];
87    $params = array_merge($params, $optParams);
88    return $this->call('create', [$params], GoogleCloudApigeeV1ApiProduct::class);
89  }
90  /**
91   * Deletes an API product from an organization. Deleting an API product causes
92   * app requests to the resource URIs defined in the API product to fail. Ensure
93   * that you create a new API product to serve existing apps, unless your
94   * intention is to disable access to the resources defined in the API product.
95   * The API product name required in the request URL is the internal name of the
96   * product, not the display name. While they may be the same, it depends on
97   * whether the API product was created via the UI or the API. View the list of
98   * API products to verify the internal name. (apiproducts.delete)
99   *
100   * @param string $name Required. Name of the API product. Use the following
101   * structure in your request: `organizations/{org}/apiproducts/{apiproduct}`
102   * @param array $optParams Optional parameters.
103   * @return GoogleCloudApigeeV1ApiProduct
104   */
105  public function delete($name, $optParams = [])
106  {
107    $params = ['name' => $name];
108    $params = array_merge($params, $optParams);
109    return $this->call('delete', [$params], GoogleCloudApigeeV1ApiProduct::class);
110  }
111  /**
112   * Gets configuration details for an API product. The API product name required
113   * in the request URL is the internal name of the product, not the display name.
114   * While they may be the same, it depends on whether the API product was created
115   * via the UI or the API. View the list of API products to verify the internal
116   * name. (apiproducts.get)
117   *
118   * @param string $name Required. Name of the API product. Use the following
119   * structure in your request: `organizations/{org}/apiproducts/{apiproduct}`
120   * @param array $optParams Optional parameters.
121   * @return GoogleCloudApigeeV1ApiProduct
122   */
123  public function get($name, $optParams = [])
124  {
125    $params = ['name' => $name];
126    $params = array_merge($params, $optParams);
127    return $this->call('get', [$params], GoogleCloudApigeeV1ApiProduct::class);
128  }
129  /**
130   * Lists all API product names for an organization. Filter the list by passing
131   * an `attributename` and `attibutevalue`. The maximum number of API products
132   * returned is 1000. You can paginate the list of API products returned using
133   * the `startKey` and `count` query parameters.
134   * (apiproducts.listOrganizationsApiproducts)
135   *
136   * @param string $parent Required. Name of the organization. Use the following
137   * structure in your request: `organizations/{org}`
138   * @param array $optParams Optional parameters.
139   *
140   * @opt_param string attributename Name of the attribute used to filter the
141   * search.
142   * @opt_param string attributevalue Value of the attribute used to filter the
143   * search.
144   * @opt_param string count Enter the number of API products you want returned in
145   * the API call. The limit is 1000.
146   * @opt_param bool expand Flag that specifies whether to expand the results. Set
147   * to `true` to get expanded details about each API.
148   * @opt_param string startKey Gets a list of API products starting with a
149   * specific API product in the list. For example, if you're returning 50 API
150   * products at a time (using the `count` query parameter), you can view products
151   * 50-99 by entering the name of the 50th API product in the first API (without
152   * using `startKey`). Product name is case sensitive.
153   * @return GoogleCloudApigeeV1ListApiProductsResponse
154   */
155  public function listOrganizationsApiproducts($parent, $optParams = [])
156  {
157    $params = ['parent' => $parent];
158    $params = array_merge($params, $optParams);
159    return $this->call('list', [$params], GoogleCloudApigeeV1ListApiProductsResponse::class);
160  }
161  /**
162   * Updates an existing API product. You must include all required values,
163   * whether or not you are updating them, as well as any optional values that you
164   * are updating. The API product name required in the request URL is the
165   * internal name of the product, not the display name. While they may be the
166   * same, it depends on whether the API product was created via UI or API. View
167   * the list of API products to identify their internal names.
168   * (apiproducts.update)
169   *
170   * @param string $name Required. Name of the API product. Use the following
171   * structure in your request: `organizations/{org}/apiproducts/{apiproduct}`
172   * @param GoogleCloudApigeeV1ApiProduct $postBody
173   * @param array $optParams Optional parameters.
174   * @return GoogleCloudApigeeV1ApiProduct
175   */
176  public function update($name, GoogleCloudApigeeV1ApiProduct $postBody, $optParams = [])
177  {
178    $params = ['name' => $name, 'postBody' => $postBody];
179    $params = array_merge($params, $optParams);
180    return $this->call('update', [$params], GoogleCloudApigeeV1ApiProduct::class);
181  }
182}
183
184// Adding a class alias for backwards compatibility with the previous class name.
185class_alias(OrganizationsApiproducts::class, 'Google_Service_Apigee_Resource_OrganizationsApiproducts');
186