1// Copyright 2020 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.osconfig.v1;
18
19import "google/api/client.proto";
20import "google/api/resource.proto";
21import "google/cloud/osconfig/v1/patch_deployments.proto";
22import "google/cloud/osconfig/v1/patch_jobs.proto";
23import "google/protobuf/empty.proto";
24import "google/api/annotations.proto";
25
26option csharp_namespace = "Google.Cloud.OsConfig.V1";
27option go_package = "cloud.google.com/go/osconfig/apiv1/osconfigpb;osconfigpb";
28option java_outer_classname = "OsConfigProto";
29option java_package = "com.google.cloud.osconfig.v1";
30option php_namespace = "Google\\Cloud\\OsConfig\\V1";
31option ruby_package = "Google::Cloud::OsConfig::V1";
32option (google.api.resource_definition) = {
33  type: "compute.googleapis.com/Instance"
34  pattern: "projects/{project}/zones/{zone}/instances/{instance}"
35  pattern: "projects/{project}/locations/{location}/instances/{instance}"
36};
37
38// OS Config API
39//
40// The OS Config service is a server-side component that you can use to
41// manage package installations and patch jobs for virtual machine instances.
42service OsConfigService {
43  option (google.api.default_host) = "osconfig.googleapis.com";
44  option (google.api.oauth_scopes) =
45      "https://www.googleapis.com/auth/cloud-platform";
46
47  // Patch VM instances by creating and running a patch job.
48  rpc ExecutePatchJob(ExecutePatchJobRequest) returns (PatchJob) {
49    option (google.api.http) = {
50      post: "/v1/{parent=projects/*}/patchJobs:execute"
51      body: "*"
52    };
53  }
54
55  // Get the patch job. This can be used to track the progress of an
56  // ongoing patch job or review the details of completed jobs.
57  rpc GetPatchJob(GetPatchJobRequest) returns (PatchJob) {
58    option (google.api.http) = {
59      get: "/v1/{name=projects/*/patchJobs/*}"
60    };
61    option (google.api.method_signature) = "name";
62  }
63
64  // Cancel a patch job. The patch job must be active. Canceled patch jobs
65  // cannot be restarted.
66  rpc CancelPatchJob(CancelPatchJobRequest) returns (PatchJob) {
67    option (google.api.http) = {
68      post: "/v1/{name=projects/*/patchJobs/*}:cancel"
69      body: "*"
70    };
71  }
72
73  // Get a list of patch jobs.
74  rpc ListPatchJobs(ListPatchJobsRequest) returns (ListPatchJobsResponse) {
75    option (google.api.http) = {
76      get: "/v1/{parent=projects/*}/patchJobs"
77    };
78    option (google.api.method_signature) = "parent";
79  }
80
81  // Get a list of instance details for a given patch job.
82  rpc ListPatchJobInstanceDetails(ListPatchJobInstanceDetailsRequest)
83      returns (ListPatchJobInstanceDetailsResponse) {
84    option (google.api.http) = {
85      get: "/v1/{parent=projects/*/patchJobs/*}/instanceDetails"
86    };
87    option (google.api.method_signature) = "parent";
88  }
89
90  // Create an OS Config patch deployment.
91  rpc CreatePatchDeployment(CreatePatchDeploymentRequest)
92      returns (PatchDeployment) {
93    option (google.api.http) = {
94      post: "/v1/{parent=projects/*}/patchDeployments"
95      body: "patch_deployment"
96    };
97    option (google.api.method_signature) =
98        "parent,patch_deployment,patch_deployment_id";
99  }
100
101  // Get an OS Config patch deployment.
102  rpc GetPatchDeployment(GetPatchDeploymentRequest) returns (PatchDeployment) {
103    option (google.api.http) = {
104      get: "/v1/{name=projects/*/patchDeployments/*}"
105    };
106    option (google.api.method_signature) = "name";
107  }
108
109  // Get a page of OS Config patch deployments.
110  rpc ListPatchDeployments(ListPatchDeploymentsRequest)
111      returns (ListPatchDeploymentsResponse) {
112    option (google.api.http) = {
113      get: "/v1/{parent=projects/*}/patchDeployments"
114    };
115    option (google.api.method_signature) = "parent";
116  }
117
118  // Delete an OS Config patch deployment.
119  rpc DeletePatchDeployment(DeletePatchDeploymentRequest)
120      returns (google.protobuf.Empty) {
121    option (google.api.http) = {
122      delete: "/v1/{name=projects/*/patchDeployments/*}"
123    };
124    option (google.api.method_signature) = "name";
125  }
126
127  // Update an OS Config patch deployment.
128  rpc UpdatePatchDeployment(UpdatePatchDeploymentRequest)
129      returns (PatchDeployment) {
130    option (google.api.http) = {
131      patch: "/v1/{patch_deployment.name=projects/*/patchDeployments/*}"
132      body: "patch_deployment"
133    };
134    option (google.api.method_signature) = "patch_deployment,update_mask";
135  }
136
137  // Change state of patch deployment to "PAUSED".
138  // Patch deployment in paused state doesn't generate patch jobs.
139  rpc PausePatchDeployment(PausePatchDeploymentRequest)
140      returns (PatchDeployment) {
141    option (google.api.http) = {
142      post: "/v1/{name=projects/*/patchDeployments/*}:pause"
143      body: "*"
144    };
145    option (google.api.method_signature) = "name";
146  }
147
148  // Change state of patch deployment back to "ACTIVE".
149  // Patch deployment in active state continues to generate patch jobs.
150  rpc ResumePatchDeployment(ResumePatchDeploymentRequest)
151      returns (PatchDeployment) {
152    option (google.api.http) = {
153      post: "/v1/{name=projects/*/patchDeployments/*}:resume"
154      body: "*"
155    };
156    option (google.api.method_signature) = "name";
157  }
158}
159