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\GoogleCloudApigeeV1ListRatePlansResponse;
21use Google\Service\Apigee\GoogleCloudApigeeV1RatePlan;
22
23/**
24 * The "rateplans" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $apigeeService = new Google\Service\Apigee(...);
28 *   $rateplans = $apigeeService->rateplans;
29 *  </code>
30 */
31class OrganizationsApiproductsRateplans extends \Google\Service\Resource
32{
33  /**
34   * Create a rate plan that is associated with an API product in an organization.
35   * Using rate plans, API product owners can monetize their API products by
36   * configuring one or more of the following: - Billing frequency - Initial setup
37   * fees for using an API product - Payment funding model (postpaid only) - Fixed
38   * recurring or consumption-based charges for using an API product - Revenue
39   * sharing with developer partners An API product can have multiple rate plans
40   * associated with it but *only one* rate plan can be active at any point of
41   * time. **Note: From the developer's perspective, they purchase API products
42   * not rate plans. (rateplans.create)
43   *
44   * @param string $parent Required. Name of the API product that is associated
45   * with the rate plan. Use the following structure in your request:
46   * `organizations/{org}/apiproducts/{apiproduct}`
47   * @param GoogleCloudApigeeV1RatePlan $postBody
48   * @param array $optParams Optional parameters.
49   * @return GoogleCloudApigeeV1RatePlan
50   */
51  public function create($parent, GoogleCloudApigeeV1RatePlan $postBody, $optParams = [])
52  {
53    $params = ['parent' => $parent, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('create', [$params], GoogleCloudApigeeV1RatePlan::class);
56  }
57  /**
58   * Deletes a rate plan. (rateplans.delete)
59   *
60   * @param string $name Required. ID of the rate plan. Use the following
61   * structure in your request:
62   * `organizations/{org}/apiproducts/{apiproduct}/rateplans/{rateplan}`
63   * @param array $optParams Optional parameters.
64   * @return GoogleCloudApigeeV1RatePlan
65   */
66  public function delete($name, $optParams = [])
67  {
68    $params = ['name' => $name];
69    $params = array_merge($params, $optParams);
70    return $this->call('delete', [$params], GoogleCloudApigeeV1RatePlan::class);
71  }
72  /**
73   * Gets the details of a rate plan. (rateplans.get)
74   *
75   * @param string $name Required. Name of the rate plan. Use the following
76   * structure in your request:
77   * `organizations/{org}/apiproducts/{apiproduct}/rateplans/{rateplan}`
78   * @param array $optParams Optional parameters.
79   * @return GoogleCloudApigeeV1RatePlan
80   */
81  public function get($name, $optParams = [])
82  {
83    $params = ['name' => $name];
84    $params = array_merge($params, $optParams);
85    return $this->call('get', [$params], GoogleCloudApigeeV1RatePlan::class);
86  }
87  /**
88   * Lists all the rate plans for an API product.
89   * (rateplans.listOrganizationsApiproductsRateplans)
90   *
91   * @param string $parent Required. Name of the API product. Use the following
92   * structure in your request: `organizations/{org}/apiproducts/{apiproduct}` Use
93   * `organizations/{org}/apiproducts/-` to return rate plans for all API products
94   * within the organization.
95   * @param array $optParams Optional parameters.
96   *
97   * @opt_param int count Number of rate plans to return in the API call. Use with
98   * the `startKey` parameter to provide more targeted filtering. The maximum
99   * limit is 1000. Defaults to 100.
100   * @opt_param bool expand Flag that specifies whether to expand the results. Set
101   * to `true` to get expanded details about each API. Defaults to `false`.
102   * @opt_param string orderBy Name of the attribute used for sorting. Valid
103   * values include: * `name`: Name of the rate plan. * `state`: State of the rate
104   * plan (`DRAFT`, `PUBLISHED`). * `startTime`: Time when the rate plan becomes
105   * active. * `endTime`: Time when the rate plan expires. **Note**: Not supported
106   * by Apigee at this time.
107   * @opt_param string startKey Name of the rate plan from which to start
108   * displaying the list of rate plans. If omitted, the list starts from the first
109   * item. For example, to view the rate plans from 51-150, set the value of
110   * `startKey` to the name of the 51st rate plan and set the value of `count` to
111   * 100.
112   * @opt_param string state State of the rate plans (`DRAFT`, `PUBLISHED`) that
113   * you want to display.
114   * @return GoogleCloudApigeeV1ListRatePlansResponse
115   */
116  public function listOrganizationsApiproductsRateplans($parent, $optParams = [])
117  {
118    $params = ['parent' => $parent];
119    $params = array_merge($params, $optParams);
120    return $this->call('list', [$params], GoogleCloudApigeeV1ListRatePlansResponse::class);
121  }
122  /**
123   * Updates an existing rate plan. (rateplans.update)
124   *
125   * @param string $name Required. Name of the rate plan. Use the following
126   * structure in your request:
127   * `organizations/{org}/apiproducts/{apiproduct}/rateplans/{rateplan}`
128   * @param GoogleCloudApigeeV1RatePlan $postBody
129   * @param array $optParams Optional parameters.
130   * @return GoogleCloudApigeeV1RatePlan
131   */
132  public function update($name, GoogleCloudApigeeV1RatePlan $postBody, $optParams = [])
133  {
134    $params = ['name' => $name, 'postBody' => $postBody];
135    $params = array_merge($params, $optParams);
136    return $this->call('update', [$params], GoogleCloudApigeeV1RatePlan::class);
137  }
138}
139
140// Adding a class alias for backwards compatibility with the previous class name.
141class_alias(OrganizationsApiproductsRateplans::class, 'Google_Service_Apigee_Resource_OrganizationsApiproductsRateplans');
142