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\CloudResourceManager\Resource;
19
20use Google\Service\CloudResourceManager\GetIamPolicyRequest;
21use Google\Service\CloudResourceManager\Organization;
22use Google\Service\CloudResourceManager\Policy;
23use Google\Service\CloudResourceManager\SearchOrganizationsResponse;
24use Google\Service\CloudResourceManager\SetIamPolicyRequest;
25use Google\Service\CloudResourceManager\TestIamPermissionsRequest;
26use Google\Service\CloudResourceManager\TestIamPermissionsResponse;
27
28/**
29 * The "organizations" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $cloudresourcemanagerService = new Google\Service\CloudResourceManager(...);
33 *   $organizations = $cloudresourcemanagerService->organizations;
34 *  </code>
35 */
36class Organizations extends \Google\Service\Resource
37{
38  /**
39   * Fetches an organization resource identified by the specified resource name.
40   * (organizations.get)
41   *
42   * @param string $name Required. The resource name of the Organization to fetch.
43   * This is the organization's relative path in the API, formatted as
44   * "organizations/[organizationId]". For example, "organizations/1234".
45   * @param array $optParams Optional parameters.
46   * @return Organization
47   */
48  public function get($name, $optParams = [])
49  {
50    $params = ['name' => $name];
51    $params = array_merge($params, $optParams);
52    return $this->call('get', [$params], Organization::class);
53  }
54  /**
55   * Gets the access control policy for an organization resource. The policy may
56   * be empty if no such policy or resource exists. The `resource` field should be
57   * the organization's resource name, for example: "organizations/123".
58   * Authorization requires the IAM permission
59   * `resourcemanager.organizations.getIamPolicy` on the specified organization.
60   * (organizations.getIamPolicy)
61   *
62   * @param string $resource REQUIRED: The resource for which the policy is being
63   * requested. See the operation documentation for the appropriate value for this
64   * field.
65   * @param GetIamPolicyRequest $postBody
66   * @param array $optParams Optional parameters.
67   * @return Policy
68   */
69  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
70  {
71    $params = ['resource' => $resource, 'postBody' => $postBody];
72    $params = array_merge($params, $optParams);
73    return $this->call('getIamPolicy', [$params], Policy::class);
74  }
75  /**
76   * Searches organization resources that are visible to the user and satisfy the
77   * specified filter. This method returns organizations in an unspecified order.
78   * New organizations do not necessarily appear at the end of the results, and
79   * may take a small amount of time to appear. Search will only return
80   * organizations on which the user has the permission
81   * `resourcemanager.organizations.get` (organizations.search)
82   *
83   * @param array $optParams Optional parameters.
84   *
85   * @opt_param int pageSize Optional. The maximum number of organizations to
86   * return in the response. The server can return fewer organizations than
87   * requested. If unspecified, server picks an appropriate default.
88   * @opt_param string pageToken Optional. A pagination token returned from a
89   * previous call to `SearchOrganizations` that indicates from where listing
90   * should continue.
91   * @opt_param string query Optional. An optional query string used to filter the
92   * Organizations to return in the response. Query rules are case-insensitive.
93   * ``` | Field | Description |
94   * |------------------|--------------------------------------------| |
95   * directoryCustomerId, owner.directoryCustomerId | Filters by directory
96   * customer id. | | domain | Filters by domain. | ``` Organizations may be
97   * queried by `directoryCustomerId` or by `domain`, where the domain is a G
98   * Suite domain, for example: * Query `directorycustomerid:123456789` returns
99   * Organization resources with `owner.directory_customer_id` equal to
100   * `123456789`. * Query `domain:google.com` returns Organization resources
101   * corresponding to the domain `google.com`.
102   * @return SearchOrganizationsResponse
103   */
104  public function search($optParams = [])
105  {
106    $params = [];
107    $params = array_merge($params, $optParams);
108    return $this->call('search', [$params], SearchOrganizationsResponse::class);
109  }
110  /**
111   * Sets the access control policy on an organization resource. Replaces any
112   * existing policy. The `resource` field should be the organization's resource
113   * name, for example: "organizations/123". Authorization requires the IAM
114   * permission `resourcemanager.organizations.setIamPolicy` on the specified
115   * organization. (organizations.setIamPolicy)
116   *
117   * @param string $resource REQUIRED: The resource for which the policy is being
118   * specified. See the operation documentation for the appropriate value for this
119   * field.
120   * @param SetIamPolicyRequest $postBody
121   * @param array $optParams Optional parameters.
122   * @return Policy
123   */
124  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
125  {
126    $params = ['resource' => $resource, 'postBody' => $postBody];
127    $params = array_merge($params, $optParams);
128    return $this->call('setIamPolicy', [$params], Policy::class);
129  }
130  /**
131   * Returns the permissions that a caller has on the specified organization. The
132   * `resource` field should be the organization's resource name, for example:
133   * "organizations/123". There are no permissions required for making this API
134   * call. (organizations.testIamPermissions)
135   *
136   * @param string $resource REQUIRED: The resource for which the policy detail is
137   * being requested. See the operation documentation for the appropriate value
138   * for this field.
139   * @param TestIamPermissionsRequest $postBody
140   * @param array $optParams Optional parameters.
141   * @return TestIamPermissionsResponse
142   */
143  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
144  {
145    $params = ['resource' => $resource, 'postBody' => $postBody];
146    $params = array_merge($params, $optParams);
147    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
148  }
149}
150
151// Adding a class alias for backwards compatibility with the previous class name.
152class_alias(Organizations::class, 'Google_Service_CloudResourceManager_Resource_Organizations');
153