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\SecurityCommandCenter\Resource;
19
20use Google\Service\SecurityCommandCenter\GetIamPolicyRequest;
21use Google\Service\SecurityCommandCenter\ListSourcesResponse;
22use Google\Service\SecurityCommandCenter\Policy;
23use Google\Service\SecurityCommandCenter\SetIamPolicyRequest;
24use Google\Service\SecurityCommandCenter\Source;
25use Google\Service\SecurityCommandCenter\TestIamPermissionsRequest;
26use Google\Service\SecurityCommandCenter\TestIamPermissionsResponse;
27
28/**
29 * The "sources" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $securitycenterService = new Google\Service\SecurityCommandCenter(...);
33 *   $sources = $securitycenterService->sources;
34 *  </code>
35 */
36class OrganizationsSources extends \Google\Service\Resource
37{
38  /**
39   * Creates a source. (sources.create)
40   *
41   * @param string $parent Required. Resource name of the new source's parent. Its
42   * format should be "organizations/[organization_id]".
43   * @param Source $postBody
44   * @param array $optParams Optional parameters.
45   * @return Source
46   */
47  public function create($parent, Source $postBody, $optParams = [])
48  {
49    $params = ['parent' => $parent, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], Source::class);
52  }
53  /**
54   * Gets a source. (sources.get)
55   *
56   * @param string $name Required. Relative resource name of the source. Its
57   * format is "organizations/[organization_id]/source/[source_id]".
58   * @param array $optParams Optional parameters.
59   * @return Source
60   */
61  public function get($name, $optParams = [])
62  {
63    $params = ['name' => $name];
64    $params = array_merge($params, $optParams);
65    return $this->call('get', [$params], Source::class);
66  }
67  /**
68   * Gets the access control policy on the specified Source.
69   * (sources.getIamPolicy)
70   *
71   * @param string $resource REQUIRED: The resource for which the policy is being
72   * requested. See the operation documentation for the appropriate value for this
73   * field.
74   * @param GetIamPolicyRequest $postBody
75   * @param array $optParams Optional parameters.
76   * @return Policy
77   */
78  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
79  {
80    $params = ['resource' => $resource, 'postBody' => $postBody];
81    $params = array_merge($params, $optParams);
82    return $this->call('getIamPolicy', [$params], Policy::class);
83  }
84  /**
85   * Lists all sources belonging to an organization.
86   * (sources.listOrganizationsSources)
87   *
88   * @param string $parent Required. Resource name of the parent of sources to
89   * list. Its format should be "organizations/[organization_id],
90   * folders/[folder_id], or projects/[project_id]".
91   * @param array $optParams Optional parameters.
92   *
93   * @opt_param int pageSize The maximum number of results to return in a single
94   * response. Default is 10, minimum is 1, maximum is 1000.
95   * @opt_param string pageToken The value returned by the last
96   * `ListSourcesResponse`; indicates that this is a continuation of a prior
97   * `ListSources` call, and that the system should return the next page of data.
98   * @return ListSourcesResponse
99   */
100  public function listOrganizationsSources($parent, $optParams = [])
101  {
102    $params = ['parent' => $parent];
103    $params = array_merge($params, $optParams);
104    return $this->call('list', [$params], ListSourcesResponse::class);
105  }
106  /**
107   * Updates a source. (sources.patch)
108   *
109   * @param string $name The relative resource name of this source. See:
110   * https://cloud.google.com/apis/design/resource_names#relative_resource_name
111   * Example: "organizations/{organization_id}/sources/{source_id}"
112   * @param Source $postBody
113   * @param array $optParams Optional parameters.
114   *
115   * @opt_param string updateMask The FieldMask to use when updating the source
116   * resource. If empty all mutable fields will be updated.
117   * @return Source
118   */
119  public function patch($name, Source $postBody, $optParams = [])
120  {
121    $params = ['name' => $name, 'postBody' => $postBody];
122    $params = array_merge($params, $optParams);
123    return $this->call('patch', [$params], Source::class);
124  }
125  /**
126   * Sets the access control policy on the specified Source.
127   * (sources.setIamPolicy)
128   *
129   * @param string $resource REQUIRED: The resource for which the policy is being
130   * specified. See the operation documentation for the appropriate value for this
131   * field.
132   * @param SetIamPolicyRequest $postBody
133   * @param array $optParams Optional parameters.
134   * @return Policy
135   */
136  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
137  {
138    $params = ['resource' => $resource, 'postBody' => $postBody];
139    $params = array_merge($params, $optParams);
140    return $this->call('setIamPolicy', [$params], Policy::class);
141  }
142  /**
143   * Returns the permissions that a caller has on the specified source.
144   * (sources.testIamPermissions)
145   *
146   * @param string $resource REQUIRED: The resource for which the policy detail is
147   * being requested. See the operation documentation for the appropriate value
148   * for this field.
149   * @param TestIamPermissionsRequest $postBody
150   * @param array $optParams Optional parameters.
151   * @return TestIamPermissionsResponse
152   */
153  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
154  {
155    $params = ['resource' => $resource, 'postBody' => $postBody];
156    $params = array_merge($params, $optParams);
157    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
158  }
159}
160
161// Adding a class alias for backwards compatibility with the previous class name.
162class_alias(OrganizationsSources::class, 'Google_Service_SecurityCommandCenter_Resource_OrganizationsSources');
163