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\CloudProfiler\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudProfiler\CreateProfileRequest;
|
---|
21 | use Google\Service\CloudProfiler\ListProfilesResponse;
|
---|
22 | use Google\Service\CloudProfiler\Profile;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "profiles" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $cloudprofilerService = new Google\Service\CloudProfiler(...);
|
---|
29 | * $profiles = $cloudprofilerService->projects_profiles;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class ProjectsProfiles extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * CreateProfile creates a new profile resource in the online mode. _Direct use
|
---|
36 | * of this API is discouraged, please use a [supported profiler
|
---|
37 | * agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
|
---|
38 | * instead for profile collection._ The server ensures that the new profiles are
|
---|
39 | * created at a constant rate per deployment, so the creation request may hang
|
---|
40 | * for some time until the next profile session is available. The request may
|
---|
41 | * fail with ABORTED error if the creation is not available within ~1m, the
|
---|
42 | * response will indicate the duration of the backoff the client should take
|
---|
43 | * before attempting creating a profile again. The backoff duration is returned
|
---|
44 | * in google.rpc.RetryInfo extension on the response status. To a gRPC client,
|
---|
45 | * the extension will be return as a binary-serialized proto in the trailing
|
---|
46 | * metadata item named "google.rpc.retryinfo-bin". (profiles.create)
|
---|
47 | *
|
---|
48 | * @param string $parent Parent project to create the profile in.
|
---|
49 | * @param CreateProfileRequest $postBody
|
---|
50 | * @param array $optParams Optional parameters.
|
---|
51 | * @return Profile
|
---|
52 | * @throws \Google\Service\Exception
|
---|
53 | */
|
---|
54 | public function create($parent, CreateProfileRequest $postBody, $optParams = [])
|
---|
55 | {
|
---|
56 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
57 | $params = array_merge($params, $optParams);
|
---|
58 | return $this->call('create', [$params], Profile::class);
|
---|
59 | }
|
---|
60 | /**
|
---|
61 | * CreateOfflineProfile creates a new profile resource in the offline mode. The
|
---|
62 | * client provides the profile to create along with the profile bytes, the
|
---|
63 | * server records it. _Direct use of this API is discouraged, please use a
|
---|
64 | * [supported profiler agent](https://cloud.google.com/profiler/docs/about-
|
---|
65 | * profiler#profiling_agent) instead for profile collection._
|
---|
66 | * (profiles.createOffline)
|
---|
67 | *
|
---|
68 | * @param string $parent Parent project to create the profile in.
|
---|
69 | * @param Profile $postBody
|
---|
70 | * @param array $optParams Optional parameters.
|
---|
71 | * @return Profile
|
---|
72 | * @throws \Google\Service\Exception
|
---|
73 | */
|
---|
74 | public function createOffline($parent, Profile $postBody, $optParams = [])
|
---|
75 | {
|
---|
76 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
77 | $params = array_merge($params, $optParams);
|
---|
78 | return $this->call('createOffline', [$params], Profile::class);
|
---|
79 | }
|
---|
80 | /**
|
---|
81 | * Lists profiles which have been collected so far and for which the caller has
|
---|
82 | * permission to view. (profiles.listProjectsProfiles)
|
---|
83 | *
|
---|
84 | * @param string $parent Required. The parent, which owns this collection of
|
---|
85 | * profiles. Format: projects/{user_project_id}
|
---|
86 | * @param array $optParams Optional parameters.
|
---|
87 | *
|
---|
88 | * @opt_param int pageSize Optional. The maximum number of items to return.
|
---|
89 | * Default page_size is 1000. Max limit is 1000.
|
---|
90 | * @opt_param string pageToken Optional. The token to continue pagination and
|
---|
91 | * get profiles from a particular page. When paginating, all other parameters
|
---|
92 | * provided to `ListProfiles` must match the call that provided the page token.
|
---|
93 | * @return ListProfilesResponse
|
---|
94 | * @throws \Google\Service\Exception
|
---|
95 | */
|
---|
96 | public function listProjectsProfiles($parent, $optParams = [])
|
---|
97 | {
|
---|
98 | $params = ['parent' => $parent];
|
---|
99 | $params = array_merge($params, $optParams);
|
---|
100 | return $this->call('list', [$params], ListProfilesResponse::class);
|
---|
101 | }
|
---|
102 | /**
|
---|
103 | * UpdateProfile updates the profile bytes and labels on the profile resource
|
---|
104 | * created in the online mode. Updating the bytes for profiles created in the
|
---|
105 | * offline mode is currently not supported: the profile content must be provided
|
---|
106 | * at the time of the profile creation. _Direct use of this API is discouraged,
|
---|
107 | * please use a [supported profiler
|
---|
108 | * agent](https://cloud.google.com/profiler/docs/about-profiler#profiling_agent)
|
---|
109 | * instead for profile collection._ (profiles.patch)
|
---|
110 | *
|
---|
111 | * @param string $name Output only. Opaque, server-assigned, unique ID for this
|
---|
112 | * profile.
|
---|
113 | * @param Profile $postBody
|
---|
114 | * @param array $optParams Optional parameters.
|
---|
115 | *
|
---|
116 | * @opt_param string updateMask Field mask used to specify the fields to be
|
---|
117 | * overwritten. Currently only profile_bytes and labels fields are supported by
|
---|
118 | * UpdateProfile, so only those fields can be specified in the mask. When no
|
---|
119 | * mask is provided, all fields are overwritten.
|
---|
120 | * @return Profile
|
---|
121 | * @throws \Google\Service\Exception
|
---|
122 | */
|
---|
123 | public function patch($name, Profile $postBody, $optParams = [])
|
---|
124 | {
|
---|
125 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
126 | $params = array_merge($params, $optParams);
|
---|
127 | return $this->call('patch', [$params], Profile::class);
|
---|
128 | }
|
---|
129 | }
|
---|
130 |
|
---|
131 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
132 | class_alias(ProjectsProfiles::class, 'Google_Service_CloudProfiler_Resource_ProjectsProfiles');
|
---|