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\ServiceControl\Resource;
19
20use Google\Service\ServiceControl\CheckRequest;
21use Google\Service\ServiceControl\CheckResponse;
22use Google\Service\ServiceControl\ReportRequest;
23use Google\Service\ServiceControl\ReportResponse;
24
25/**
26 * The "services" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $servicecontrolService = new Google\Service\ServiceControl(...);
30 *   $services = $servicecontrolService->services;
31 *  </code>
32 */
33class Services extends \Google\Service\Resource
34{
35  /**
36   * Private Preview. This feature is only available for approved services. This
37   * method provides admission control for services that are integrated with
38   * [Service Infrastructure](https://cloud.google.com/service-infrastructure). It
39   * checks whether an operation should be allowed based on the service
40   * configuration and relevant policies. It must be called before the operation
41   * is executed. For more information, see [Admission
42   * Control](https://cloud.google.com/service-infrastructure/docs/admission-
43   * control). NOTE: The admission control has an expected policy propagation
44   * delay of 60s. The caller **must** not depend on the most recent policy
45   * changes. NOTE: The admission control has a hard limit of 1 referenced
46   * resources per call. If an operation refers to more than 1 resources, the
47   * caller must call the Check method multiple times. This method requires the
48   * `servicemanagement.services.check` permission on the specified service. For
49   * more information, see [Service Control API Access
50   * Control](https://cloud.google.com/service-infrastructure/docs/service-control
51   * /access-control). (services.check)
52   *
53   * @param string $serviceName The service name as specified in its service
54   * configuration. For example, `"pubsub.googleapis.com"`. See
55   * [google.api.Service](https://cloud.google.com/service-
56   * management/reference/rpc/google.api#google.api.Service) for the definition of
57   * a service name.
58   * @param CheckRequest $postBody
59   * @param array $optParams Optional parameters.
60   * @return CheckResponse
61   */
62  public function check($serviceName, CheckRequest $postBody, $optParams = [])
63  {
64    $params = ['serviceName' => $serviceName, 'postBody' => $postBody];
65    $params = array_merge($params, $optParams);
66    return $this->call('check', [$params], CheckResponse::class);
67  }
68  /**
69   * Private Preview. This feature is only available for approved services. This
70   * method provides telemetry reporting for services that are integrated with
71   * [Service Infrastructure](https://cloud.google.com/service-infrastructure). It
72   * reports a list of operations that have occurred on a service. It must be
73   * called after the operations have been executed. For more information, see
74   * [Telemetry Reporting](https://cloud.google.com/service-infrastructure/docs
75   * /telemetry-reporting). NOTE: The telemetry reporting has a hard limit of 1000
76   * operations and 1MB per Report call. It is recommended to have no more than
77   * 100 operations per call. This method requires the
78   * `servicemanagement.services.report` permission on the specified service. For
79   * more information, see [Service Control API Access
80   * Control](https://cloud.google.com/service-infrastructure/docs/service-control
81   * /access-control). (services.report)
82   *
83   * @param string $serviceName The service name as specified in its service
84   * configuration. For example, `"pubsub.googleapis.com"`. See
85   * [google.api.Service](https://cloud.google.com/service-
86   * management/reference/rpc/google.api#google.api.Service) for the definition of
87   * a service name.
88   * @param ReportRequest $postBody
89   * @param array $optParams Optional parameters.
90   * @return ReportResponse
91   */
92  public function report($serviceName, ReportRequest $postBody, $optParams = [])
93  {
94    $params = ['serviceName' => $serviceName, 'postBody' => $postBody];
95    $params = array_merge($params, $optParams);
96    return $this->call('report', [$params], ReportResponse::class);
97  }
98}
99
100// Adding a class alias for backwards compatibility with the previous class name.
101class_alias(Services::class, 'Google_Service_ServiceControl_Resource_Services');
102