[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Logging\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Logging\ListSinksResponse;
|
---|
| 21 | use Google\Service\Logging\LogSink;
|
---|
| 22 | use Google\Service\Logging\LoggingEmpty;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "sinks" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $loggingService = new Google\Service\Logging(...);
|
---|
| 29 | * $sinks = $loggingService->organizations_sinks;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class OrganizationsSinks extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates a sink that exports specified log entries to a destination. The
|
---|
| 36 | * export begins upon ingress, unless the sink's writer_identity is not
|
---|
| 37 | * permitted to write to the destination. A sink can export log entries only
|
---|
| 38 | * from the resource owning the sink. (sinks.create)
|
---|
| 39 | *
|
---|
| 40 | * @param string $parent Required. The resource in which to create the sink:
|
---|
| 41 | * "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
|
---|
| 42 | * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]" For
|
---|
| 43 | * examples:"projects/my-project" "organizations/123456789"
|
---|
| 44 | * @param LogSink $postBody
|
---|
| 45 | * @param array $optParams Optional parameters.
|
---|
| 46 | *
|
---|
| 47 | * @opt_param string customWriterIdentity Optional. The service account provided
|
---|
| 48 | * by the caller that will be used to write the log entries. The format must be
|
---|
| 49 | * serviceAccount:some@email. This field can only be specified when you are
|
---|
| 50 | * routing logs to a log bucket that is in a different project than the sink.
|
---|
| 51 | * When not specified, a Logging service account will automatically be
|
---|
| 52 | * generated.
|
---|
| 53 | * @opt_param bool uniqueWriterIdentity Optional. Determines the kind of IAM
|
---|
| 54 | * identity returned as writer_identity in the new sink. If this value is
|
---|
| 55 | * omitted or set to false, and if the sink's parent is a project, then the
|
---|
| 56 | * value returned as writer_identity is the same group or service account used
|
---|
| 57 | * by Cloud Logging before the addition of writer identities to this API. The
|
---|
| 58 | * sink's destination must be in the same project as the sink itself.If this
|
---|
| 59 | * field is set to true, or if the sink is owned by a non-project resource such
|
---|
| 60 | * as an organization, then the value of writer_identity will be a service agent
|
---|
| 61 | * (https://cloud.google.com/iam/docs/service-account-types#service-agents) used
|
---|
| 62 | * by the sinks with the same parent. For more information, see writer_identity
|
---|
| 63 | * in LogSink.
|
---|
| 64 | * @return LogSink
|
---|
| 65 | * @throws \Google\Service\Exception
|
---|
| 66 | */
|
---|
| 67 | public function create($parent, LogSink $postBody, $optParams = [])
|
---|
| 68 | {
|
---|
| 69 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 70 | $params = array_merge($params, $optParams);
|
---|
| 71 | return $this->call('create', [$params], LogSink::class);
|
---|
| 72 | }
|
---|
| 73 | /**
|
---|
| 74 | * Deletes a sink. If the sink has a unique writer_identity, then that service
|
---|
| 75 | * account is also deleted. (sinks.delete)
|
---|
| 76 | *
|
---|
| 77 | * @param string $sinkName Required. The full resource name of the sink to
|
---|
| 78 | * delete, including the parent resource and the sink identifier:
|
---|
| 79 | * "projects/[PROJECT_ID]/sinks/[SINK_ID]"
|
---|
| 80 | * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
|
---|
| 81 | * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
|
---|
| 82 | * "folders/[FOLDER_ID]/sinks/[SINK_ID]" For example:"projects/my-
|
---|
| 83 | * project/sinks/my-sink"
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | * @return LoggingEmpty
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function delete($sinkName, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['sinkName' => $sinkName];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('delete', [$params], LoggingEmpty::class);
|
---|
| 93 | }
|
---|
| 94 | /**
|
---|
| 95 | * Gets a sink. (sinks.get)
|
---|
| 96 | *
|
---|
| 97 | * @param string $sinkName Required. The resource name of the sink:
|
---|
| 98 | * "projects/[PROJECT_ID]/sinks/[SINK_ID]"
|
---|
| 99 | * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
|
---|
| 100 | * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
|
---|
| 101 | * "folders/[FOLDER_ID]/sinks/[SINK_ID]" For example:"projects/my-
|
---|
| 102 | * project/sinks/my-sink"
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return LogSink
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function get($sinkName, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['sinkName' => $sinkName];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('get', [$params], LogSink::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Lists sinks. (sinks.listOrganizationsSinks)
|
---|
| 115 | *
|
---|
| 116 | * @param string $parent Required. The parent resource whose sinks are to be
|
---|
| 117 | * listed: "projects/[PROJECT_ID]" "organizations/[ORGANIZATION_ID]"
|
---|
| 118 | * "billingAccounts/[BILLING_ACCOUNT_ID]" "folders/[FOLDER_ID]"
|
---|
| 119 | * @param array $optParams Optional parameters.
|
---|
| 120 | *
|
---|
| 121 | * @opt_param string filter Optional. A filter expression to constrain the sinks
|
---|
| 122 | * returned. Today, this only supports the following strings: ''
|
---|
| 123 | * 'in_scope("ALL")', 'in_scope("ANCESTOR")', 'in_scope("DEFAULT")'.Description
|
---|
| 124 | * of scopes below. ALL: Includes all of the sinks which can be returned in any
|
---|
| 125 | * other scope. ANCESTOR: Includes intercepting sinks owned by ancestor
|
---|
| 126 | * resources. DEFAULT: Includes sinks owned by parent.When the empty string is
|
---|
| 127 | * provided, then the filter 'in_scope("DEFAULT")' is applied.
|
---|
| 128 | * @opt_param int pageSize Optional. The maximum number of results to return
|
---|
| 129 | * from this request. Non-positive values are ignored. The presence of
|
---|
| 130 | * nextPageToken in the response indicates that more results might be available.
|
---|
| 131 | * @opt_param string pageToken Optional. If present, then retrieve the next
|
---|
| 132 | * batch of results from the preceding call to this method. pageToken must be
|
---|
| 133 | * the value of nextPageToken from the previous response. The values of other
|
---|
| 134 | * method parameters should be identical to those in the previous call.
|
---|
| 135 | * @return ListSinksResponse
|
---|
| 136 | * @throws \Google\Service\Exception
|
---|
| 137 | */
|
---|
| 138 | public function listOrganizationsSinks($parent, $optParams = [])
|
---|
| 139 | {
|
---|
| 140 | $params = ['parent' => $parent];
|
---|
| 141 | $params = array_merge($params, $optParams);
|
---|
| 142 | return $this->call('list', [$params], ListSinksResponse::class);
|
---|
| 143 | }
|
---|
| 144 | /**
|
---|
| 145 | * Updates a sink. This method replaces the values of the destination and filter
|
---|
| 146 | * fields of the existing sink with the corresponding values from the new
|
---|
| 147 | * sink.The updated sink might also have a new writer_identity; see the
|
---|
| 148 | * unique_writer_identity field. (sinks.patch)
|
---|
| 149 | *
|
---|
| 150 | * @param string $sinkName Required. The full resource name of the sink to
|
---|
| 151 | * update, including the parent resource and the sink identifier:
|
---|
| 152 | * "projects/[PROJECT_ID]/sinks/[SINK_ID]"
|
---|
| 153 | * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
|
---|
| 154 | * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
|
---|
| 155 | * "folders/[FOLDER_ID]/sinks/[SINK_ID]" For example:"projects/my-
|
---|
| 156 | * project/sinks/my-sink"
|
---|
| 157 | * @param LogSink $postBody
|
---|
| 158 | * @param array $optParams Optional parameters.
|
---|
| 159 | *
|
---|
| 160 | * @opt_param string customWriterIdentity Optional. The service account provided
|
---|
| 161 | * by the caller that will be used to write the log entries. The format must be
|
---|
| 162 | * serviceAccount:some@email. This field can only be specified when you are
|
---|
| 163 | * routing logs to a log bucket that is in a different project than the sink.
|
---|
| 164 | * When not specified, a Logging service account will automatically be
|
---|
| 165 | * generated.
|
---|
| 166 | * @opt_param bool uniqueWriterIdentity Optional. See sinks.create for a
|
---|
| 167 | * description of this field. When updating a sink, the effect of this field on
|
---|
| 168 | * the value of writer_identity in the updated sink depends on both the old and
|
---|
| 169 | * new values of this field: If the old and new values of this field are both
|
---|
| 170 | * false or both true, then there is no change to the sink's writer_identity. If
|
---|
| 171 | * the old value is false and the new value is true, then writer_identity is
|
---|
| 172 | * changed to a service agent (https://cloud.google.com/iam/docs/service-
|
---|
| 173 | * account-types#service-agents) owned by Cloud Logging. It is an error if the
|
---|
| 174 | * old value is true and the new value is set to false or defaulted to false.
|
---|
| 175 | * @opt_param string updateMask Optional. Field mask that specifies the fields
|
---|
| 176 | * in sink that need an update. A sink field will be overwritten if, and only
|
---|
| 177 | * if, it is in the update mask. name and output only fields cannot be
|
---|
| 178 | * updated.An empty updateMask is temporarily treated as using the following
|
---|
| 179 | * mask for backwards compatibility
|
---|
| 180 | * purposes:destination,filter,includeChildrenAt some point in the future,
|
---|
| 181 | * behavior will be removed and specifying an empty updateMask will be an
|
---|
| 182 | * error.For a detailed FieldMask definition, see
|
---|
| 183 | * https://developers.google.com/protocol-
|
---|
| 184 | * buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskFor example:
|
---|
| 185 | * updateMask=filter
|
---|
| 186 | * @return LogSink
|
---|
| 187 | * @throws \Google\Service\Exception
|
---|
| 188 | */
|
---|
| 189 | public function patch($sinkName, LogSink $postBody, $optParams = [])
|
---|
| 190 | {
|
---|
| 191 | $params = ['sinkName' => $sinkName, 'postBody' => $postBody];
|
---|
| 192 | $params = array_merge($params, $optParams);
|
---|
| 193 | return $this->call('patch', [$params], LogSink::class);
|
---|
| 194 | }
|
---|
| 195 | /**
|
---|
| 196 | * Updates a sink. This method replaces the values of the destination and filter
|
---|
| 197 | * fields of the existing sink with the corresponding values from the new
|
---|
| 198 | * sink.The updated sink might also have a new writer_identity; see the
|
---|
| 199 | * unique_writer_identity field. (sinks.update)
|
---|
| 200 | *
|
---|
| 201 | * @param string $sinkName Required. The full resource name of the sink to
|
---|
| 202 | * update, including the parent resource and the sink identifier:
|
---|
| 203 | * "projects/[PROJECT_ID]/sinks/[SINK_ID]"
|
---|
| 204 | * "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
|
---|
| 205 | * "billingAccounts/[BILLING_ACCOUNT_ID]/sinks/[SINK_ID]"
|
---|
| 206 | * "folders/[FOLDER_ID]/sinks/[SINK_ID]" For example:"projects/my-
|
---|
| 207 | * project/sinks/my-sink"
|
---|
| 208 | * @param LogSink $postBody
|
---|
| 209 | * @param array $optParams Optional parameters.
|
---|
| 210 | *
|
---|
| 211 | * @opt_param string customWriterIdentity Optional. The service account provided
|
---|
| 212 | * by the caller that will be used to write the log entries. The format must be
|
---|
| 213 | * serviceAccount:some@email. This field can only be specified when you are
|
---|
| 214 | * routing logs to a log bucket that is in a different project than the sink.
|
---|
| 215 | * When not specified, a Logging service account will automatically be
|
---|
| 216 | * generated.
|
---|
| 217 | * @opt_param bool uniqueWriterIdentity Optional. See sinks.create for a
|
---|
| 218 | * description of this field. When updating a sink, the effect of this field on
|
---|
| 219 | * the value of writer_identity in the updated sink depends on both the old and
|
---|
| 220 | * new values of this field: If the old and new values of this field are both
|
---|
| 221 | * false or both true, then there is no change to the sink's writer_identity. If
|
---|
| 222 | * the old value is false and the new value is true, then writer_identity is
|
---|
| 223 | * changed to a service agent (https://cloud.google.com/iam/docs/service-
|
---|
| 224 | * account-types#service-agents) owned by Cloud Logging. It is an error if the
|
---|
| 225 | * old value is true and the new value is set to false or defaulted to false.
|
---|
| 226 | * @opt_param string updateMask Optional. Field mask that specifies the fields
|
---|
| 227 | * in sink that need an update. A sink field will be overwritten if, and only
|
---|
| 228 | * if, it is in the update mask. name and output only fields cannot be
|
---|
| 229 | * updated.An empty updateMask is temporarily treated as using the following
|
---|
| 230 | * mask for backwards compatibility
|
---|
| 231 | * purposes:destination,filter,includeChildrenAt some point in the future,
|
---|
| 232 | * behavior will be removed and specifying an empty updateMask will be an
|
---|
| 233 | * error.For a detailed FieldMask definition, see
|
---|
| 234 | * https://developers.google.com/protocol-
|
---|
| 235 | * buffers/docs/reference/google.protobuf#google.protobuf.FieldMaskFor example:
|
---|
| 236 | * updateMask=filter
|
---|
| 237 | * @return LogSink
|
---|
| 238 | * @throws \Google\Service\Exception
|
---|
| 239 | */
|
---|
| 240 | public function update($sinkName, LogSink $postBody, $optParams = [])
|
---|
| 241 | {
|
---|
| 242 | $params = ['sinkName' => $sinkName, 'postBody' => $postBody];
|
---|
| 243 | $params = array_merge($params, $optParams);
|
---|
| 244 | return $this->call('update', [$params], LogSink::class);
|
---|
| 245 | }
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 249 | class_alias(OrganizationsSinks::class, 'Google_Service_Logging_Resource_OrganizationsSinks');
|
---|