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\AndroidManagement\Resource;
19
20use Google\Service\AndroidManagement\AndroidmanagementEmpty;
21use Google\Service\AndroidManagement\ListPoliciesResponse;
22use Google\Service\AndroidManagement\Policy;
23
24/**
25 * The "policies" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $androidmanagementService = new Google\Service\AndroidManagement(...);
29 *   $policies = $androidmanagementService->policies;
30 *  </code>
31 */
32class EnterprisesPolicies extends \Google\Service\Resource
33{
34  /**
35   * Deletes a policy. This operation is only permitted if no devices are
36   * currently referencing the policy. (policies.delete)
37   *
38   * @param string $name The name of the policy in the form
39   * enterprises/{enterpriseId}/policies/{policyId}.
40   * @param array $optParams Optional parameters.
41   * @return AndroidmanagementEmpty
42   */
43  public function delete($name, $optParams = [])
44  {
45    $params = ['name' => $name];
46    $params = array_merge($params, $optParams);
47    return $this->call('delete', [$params], AndroidmanagementEmpty::class);
48  }
49  /**
50   * Gets a policy. (policies.get)
51   *
52   * @param string $name The name of the policy in the form
53   * enterprises/{enterpriseId}/policies/{policyId}.
54   * @param array $optParams Optional parameters.
55   * @return Policy
56   */
57  public function get($name, $optParams = [])
58  {
59    $params = ['name' => $name];
60    $params = array_merge($params, $optParams);
61    return $this->call('get', [$params], Policy::class);
62  }
63  /**
64   * Lists policies for a given enterprise. (policies.listEnterprisesPolicies)
65   *
66   * @param string $parent The name of the enterprise in the form
67   * enterprises/{enterpriseId}.
68   * @param array $optParams Optional parameters.
69   *
70   * @opt_param int pageSize The requested page size. The actual page size may be
71   * fixed to a min or max value.
72   * @opt_param string pageToken A token identifying a page of results returned by
73   * the server.
74   * @return ListPoliciesResponse
75   */
76  public function listEnterprisesPolicies($parent, $optParams = [])
77  {
78    $params = ['parent' => $parent];
79    $params = array_merge($params, $optParams);
80    return $this->call('list', [$params], ListPoliciesResponse::class);
81  }
82  /**
83   * Updates or creates a policy. (policies.patch)
84   *
85   * @param string $name The name of the policy in the form
86   * enterprises/{enterpriseId}/policies/{policyId}.
87   * @param Policy $postBody
88   * @param array $optParams Optional parameters.
89   *
90   * @opt_param string updateMask The field mask indicating the fields to update.
91   * If not set, all modifiable fields will be modified.
92   * @return Policy
93   */
94  public function patch($name, Policy $postBody, $optParams = [])
95  {
96    $params = ['name' => $name, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('patch', [$params], Policy::class);
99  }
100}
101
102// Adding a class alias for backwards compatibility with the previous class name.
103class_alias(EnterprisesPolicies::class, 'Google_Service_AndroidManagement_Resource_EnterprisesPolicies');
104