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\CloudProfiler\Resource;
19
20use Google\Service\CloudProfiler\CreateProfileRequest;
21use Google\Service\CloudProfiler\Profile;
22
23/**
24 * The "profiles" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $cloudprofilerService = new Google\Service\CloudProfiler(...);
28 *   $profiles = $cloudprofilerService->profiles;
29 *  </code>
30 */
31class ProjectsProfiles extends \Google\Service\Resource
32{
33  /**
34   * CreateProfile creates a new profile resource in the online mode. The server
35   * ensures that the new profiles are created at a constant rate per deployment,
36   * so the creation request may hang for some time until the next profile session
37   * is available. The request may fail with ABORTED error if the creation is not
38   * available within ~1m, the response will indicate the duration of the backoff
39   * the client should take before attempting creating a profile again. The
40   * backoff duration is returned in google.rpc.RetryInfo extension on the
41   * response status. To a gRPC client, the extension will be return as a binary-
42   * serialized proto in the trailing metadata item named "google.rpc.retryinfo-
43   * bin".  (profiles.create)
44   *
45   * @param string $parent Parent project to create the profile in.
46   * @param CreateProfileRequest $postBody
47   * @param array $optParams Optional parameters.
48   * @return Profile
49   */
50  public function create($parent, CreateProfileRequest $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], Profile::class);
55  }
56  /**
57   * CreateOfflineProfile creates a new profile resource in the offline mode. The
58   * client provides the profile to create along with the profile bytes, the
59   * server records it. (profiles.createOffline)
60   *
61   * @param string $parent Parent project to create the profile in.
62   * @param Profile $postBody
63   * @param array $optParams Optional parameters.
64   * @return Profile
65   */
66  public function createOffline($parent, Profile $postBody, $optParams = [])
67  {
68    $params = ['parent' => $parent, 'postBody' => $postBody];
69    $params = array_merge($params, $optParams);
70    return $this->call('createOffline', [$params], Profile::class);
71  }
72  /**
73   * UpdateProfile updates the profile bytes and labels on the profile resource
74   * created in the online mode. Updating the bytes for profiles created in the
75   * offline mode is currently not supported: the profile content must be provided
76   * at the time of the profile creation. (profiles.patch)
77   *
78   * @param string $name Output only. Opaque, server-assigned, unique ID for this
79   * profile.
80   * @param Profile $postBody
81   * @param array $optParams Optional parameters.
82   *
83   * @opt_param string updateMask Field mask used to specify the fields to be
84   * overwritten. Currently only profile_bytes and labels fields are supported by
85   * UpdateProfile, so only those fields can be specified in the mask. When no
86   * mask is provided, all fields are overwritten.
87   * @return Profile
88   */
89  public function patch($name, Profile $postBody, $optParams = [])
90  {
91    $params = ['name' => $name, 'postBody' => $postBody];
92    $params = array_merge($params, $optParams);
93    return $this->call('patch', [$params], Profile::class);
94  }
95}
96
97// Adding a class alias for backwards compatibility with the previous class name.
98class_alias(ProjectsProfiles::class, 'Google_Service_CloudProfiler_Resource_ProjectsProfiles');
99