patch_jobs.proto 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  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. syntax = "proto3";
  15. package google.cloud.osconfig.v1beta;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/duration.proto";
  19. import "google/protobuf/timestamp.proto";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1beta;osconfig";
  21. option java_outer_classname = "PatchJobs";
  22. option java_package = "com.google.cloud.osconfig.v1beta";
  23. // A request message to initiate patching across Google Compute Engine
  24. // instances.
  25. message ExecutePatchJobRequest {
  26. // Required. The project in which to run this patch in the form `projects/*`
  27. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  28. // Description of the patch job. Length of the description is limited
  29. // to 1024 characters.
  30. string description = 2;
  31. // Required. Instances to patch, either explicitly or filtered by some criteria such
  32. // as zone or labels.
  33. PatchInstanceFilter instance_filter = 7 [(google.api.field_behavior) = REQUIRED];
  34. // Patch configuration being applied. If omitted, instances are
  35. // patched using the default configurations.
  36. PatchConfig patch_config = 4;
  37. // Duration of the patch job. After the duration ends, the patch job
  38. // times out.
  39. google.protobuf.Duration duration = 5;
  40. // If this patch is a dry-run only, instances are contacted but
  41. // will do nothing.
  42. bool dry_run = 6;
  43. // Display name for this patch job. This does not have to be unique.
  44. string display_name = 8;
  45. }
  46. // Request to get an active or completed patch job.
  47. message GetPatchJobRequest {
  48. // Required. Name of the patch in the form `projects/*/patchJobs/*`
  49. string name = 1 [(google.api.field_behavior) = REQUIRED];
  50. }
  51. // Request to list details for all instances that are part of a patch job.
  52. message ListPatchJobInstanceDetailsRequest {
  53. // Required. The parent for the instances are in the form of `projects/*/patchJobs/*`.
  54. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  55. // The maximum number of instance details records to return. Default is 100.
  56. int32 page_size = 2;
  57. // A pagination token returned from a previous call
  58. // that indicates where this listing should continue from.
  59. string page_token = 3;
  60. // A filter expression that filters results listed in the response. This
  61. // field supports filtering results by instance zone, name, state, or
  62. // `failure_reason`.
  63. string filter = 4;
  64. }
  65. // A response message for listing the instances details for a patch job.
  66. message ListPatchJobInstanceDetailsResponse {
  67. // A list of instance status.
  68. repeated PatchJobInstanceDetails patch_job_instance_details = 1;
  69. // A pagination token that can be used to get the next page of results.
  70. string next_page_token = 2;
  71. }
  72. // Patch details for a VM instance. For more information about reviewing VM
  73. // instance details, see
  74. // [Listing all VM instance details for a specific patch
  75. // job](/compute/docs/os-patch-management/manage-patch-jobs#list-instance-details).
  76. message PatchJobInstanceDetails {
  77. // The instance name in the form `projects/*/zones/*/instances/*`
  78. string name = 1;
  79. // The unique identifier for the instance. This identifier is
  80. // defined by the server.
  81. string instance_system_id = 2;
  82. // Current state of instance patch.
  83. Instance.PatchState state = 3;
  84. // If the patch fails, this field provides the reason.
  85. string failure_reason = 4;
  86. // The number of times the agent that the agent attempts to apply the patch.
  87. int64 attempt_count = 5;
  88. }
  89. // A request message for listing patch jobs.
  90. message ListPatchJobsRequest {
  91. // Required. In the form of `projects/*`
  92. string parent = 1 [(google.api.field_behavior) = REQUIRED];
  93. // The maximum number of instance status to return.
  94. int32 page_size = 2;
  95. // A pagination token returned from a previous call
  96. // that indicates where this listing should continue from.
  97. string page_token = 3;
  98. // If provided, this field specifies the criteria that must be met by patch
  99. // jobs to be included in the response.
  100. // Currently, filtering is only available on the patch_deployment field.
  101. string filter = 4;
  102. }
  103. // A response message for listing patch jobs.
  104. message ListPatchJobsResponse {
  105. // The list of patch jobs.
  106. repeated PatchJob patch_jobs = 1;
  107. // A pagination token that can be used to get the next page of results.
  108. string next_page_token = 2;
  109. }
  110. // A high level representation of a patch job that is either in progress
  111. // or has completed.
  112. //
  113. // Instances details are not included in the job. To paginate through instance
  114. // details, use ListPatchJobInstanceDetails.
  115. //
  116. // For more information about patch jobs, see
  117. // [Creating patch jobs](/compute/docs/os-patch-management/create-patch-job).
  118. message PatchJob {
  119. // A summary of the current patch state across all instances that this patch
  120. // job affects. Contains counts of instances in different states. These states
  121. // map to `InstancePatchState`. List patch job instance details to see the
  122. // specific states of each instance.
  123. message InstanceDetailsSummary {
  124. // Number of instances pending patch job.
  125. int64 pending_instance_count = 1;
  126. // Number of instances that are inactive.
  127. int64 inactive_instance_count = 2;
  128. // Number of instances notified about patch job.
  129. int64 notified_instance_count = 3;
  130. // Number of instances that have started.
  131. int64 started_instance_count = 4;
  132. // Number of instances that are downloading patches.
  133. int64 downloading_patches_instance_count = 5;
  134. // Number of instances that are applying patches.
  135. int64 applying_patches_instance_count = 6;
  136. // Number of instances rebooting.
  137. int64 rebooting_instance_count = 7;
  138. // Number of instances that have completed successfully.
  139. int64 succeeded_instance_count = 8;
  140. // Number of instances that require reboot.
  141. int64 succeeded_reboot_required_instance_count = 9;
  142. // Number of instances that failed.
  143. int64 failed_instance_count = 10;
  144. // Number of instances that have acked and will start shortly.
  145. int64 acked_instance_count = 11;
  146. // Number of instances that exceeded the time out while applying the patch.
  147. int64 timed_out_instance_count = 12;
  148. // Number of instances that are running the pre-patch step.
  149. int64 pre_patch_step_instance_count = 13;
  150. // Number of instances that are running the post-patch step.
  151. int64 post_patch_step_instance_count = 14;
  152. // Number of instances that do not appear to be running the agent. Check to
  153. // ensure that the agent is installed, running, and able to communicate with
  154. // the service.
  155. int64 no_agent_detected_instance_count = 15;
  156. }
  157. // Enumeration of the various states a patch job passes through as it
  158. // executes.
  159. enum State {
  160. // State must be specified.
  161. STATE_UNSPECIFIED = 0;
  162. // The patch job was successfully initiated.
  163. STARTED = 1;
  164. // The patch job is looking up instances to run the patch on.
  165. INSTANCE_LOOKUP = 2;
  166. // Instances are being patched.
  167. PATCHING = 3;
  168. // Patch job completed successfully.
  169. SUCCEEDED = 4;
  170. // Patch job completed but there were errors.
  171. COMPLETED_WITH_ERRORS = 5;
  172. // The patch job was canceled.
  173. CANCELED = 6;
  174. // The patch job timed out.
  175. TIMED_OUT = 7;
  176. }
  177. // Unique identifier for this patch job in the form
  178. // `projects/*/patchJobs/*`
  179. string name = 1;
  180. // Display name for this patch job. This is not a unique identifier.
  181. string display_name = 14;
  182. // Description of the patch job. Length of the description is limited
  183. // to 1024 characters.
  184. string description = 2;
  185. // Time this patch job was created.
  186. google.protobuf.Timestamp create_time = 3;
  187. // Last time this patch job was updated.
  188. google.protobuf.Timestamp update_time = 4;
  189. // The current state of the PatchJob .
  190. State state = 5;
  191. // Instances to patch.
  192. PatchInstanceFilter instance_filter = 13;
  193. // Patch configuration being applied.
  194. PatchConfig patch_config = 7;
  195. // Duration of the patch job. After the duration ends, the
  196. // patch job times out.
  197. google.protobuf.Duration duration = 8;
  198. // Summary of instance details.
  199. InstanceDetailsSummary instance_details_summary = 9;
  200. // If this patch job is a dry run, the agent reports that it has
  201. // finished without running any updates on the VM instance.
  202. bool dry_run = 10;
  203. // If this patch job failed, this message provides information about the
  204. // failure.
  205. string error_message = 11;
  206. // Reflects the overall progress of the patch job in the range of
  207. // 0.0 being no progress to 100.0 being complete.
  208. double percent_complete = 12;
  209. // Output only. Name of the patch deployment that created this patch job.
  210. string patch_deployment = 15 [(google.api.field_behavior) = OUTPUT_ONLY];
  211. }
  212. // Patch configuration specifications. Contains details on how to apply the
  213. // patch(es) to a VM instance.
  214. message PatchConfig {
  215. // Post-patch reboot settings.
  216. enum RebootConfig {
  217. // The default behavior is DEFAULT.
  218. REBOOT_CONFIG_UNSPECIFIED = 0;
  219. // The agent decides if a reboot is necessary by checking signals such as
  220. // registry keys on Windows or `/var/run/reboot-required` on APT based
  221. // systems. On RPM based systems, a set of core system package install times
  222. // are compared with system boot time.
  223. DEFAULT = 1;
  224. // Always reboot the machine after the update completes.
  225. ALWAYS = 2;
  226. // Never reboot the machine after the update completes.
  227. NEVER = 3;
  228. }
  229. // Post-patch reboot settings.
  230. RebootConfig reboot_config = 1;
  231. // Apt update settings. Use this setting to override the default `apt` patch
  232. // rules.
  233. AptSettings apt = 3;
  234. // Yum update settings. Use this setting to override the default `yum` patch
  235. // rules.
  236. YumSettings yum = 4;
  237. // Goo update settings. Use this setting to override the default `goo` patch
  238. // rules.
  239. GooSettings goo = 5;
  240. // Zypper update settings. Use this setting to override the default `zypper`
  241. // patch rules.
  242. ZypperSettings zypper = 6;
  243. // Windows update settings. Use this override the default windows patch rules.
  244. WindowsUpdateSettings windows_update = 7;
  245. // The `ExecStep` to run before the patch update.
  246. ExecStep pre_step = 8;
  247. // The `ExecStep` to run after the patch update.
  248. ExecStep post_step = 9;
  249. }
  250. // Namespace for instance state enums.
  251. message Instance {
  252. // Patch state of an instance.
  253. enum PatchState {
  254. // Unspecified.
  255. PATCH_STATE_UNSPECIFIED = 0;
  256. // The instance is not yet notified.
  257. PENDING = 1;
  258. // Instance is inactive and cannot be patched.
  259. INACTIVE = 2;
  260. // The instance is notified that it should be patched.
  261. NOTIFIED = 3;
  262. // The instance has started the patching process.
  263. STARTED = 4;
  264. // The instance is downloading patches.
  265. DOWNLOADING_PATCHES = 5;
  266. // The instance is applying patches.
  267. APPLYING_PATCHES = 6;
  268. // The instance is rebooting.
  269. REBOOTING = 7;
  270. // The instance has completed applying patches.
  271. SUCCEEDED = 8;
  272. // The instance has completed applying patches but a reboot is required.
  273. SUCCEEDED_REBOOT_REQUIRED = 9;
  274. // The instance has failed to apply the patch.
  275. FAILED = 10;
  276. // The instance acked the notification and will start shortly.
  277. ACKED = 11;
  278. // The instance exceeded the time out while applying the patch.
  279. TIMED_OUT = 12;
  280. // The instance is running the pre-patch step.
  281. RUNNING_PRE_PATCH_STEP = 13;
  282. // The instance is running the post-patch step.
  283. RUNNING_POST_PATCH_STEP = 14;
  284. // The service could not detect the presence of the agent. Check to ensure
  285. // that the agent is installed, running, and able to communicate with the
  286. // service.
  287. NO_AGENT_DETECTED = 15;
  288. }
  289. }
  290. // Message for canceling a patch job.
  291. message CancelPatchJobRequest {
  292. // Required. Name of the patch in the form `projects/*/patchJobs/*`
  293. string name = 1 [(google.api.field_behavior) = REQUIRED];
  294. }
  295. // Apt patching is completed by executing `apt-get update && apt-get
  296. // upgrade`. Additional options can be set to control how this is executed.
  297. message AptSettings {
  298. // Apt patch type.
  299. enum Type {
  300. // By default, upgrade will be performed.
  301. TYPE_UNSPECIFIED = 0;
  302. // Runs `apt-get dist-upgrade`.
  303. DIST = 1;
  304. // Runs `apt-get upgrade`.
  305. UPGRADE = 2;
  306. }
  307. // By changing the type to DIST, the patching is performed
  308. // using `apt-get dist-upgrade` instead.
  309. Type type = 1;
  310. // List of packages to exclude from update. These packages will be excluded
  311. repeated string excludes = 2;
  312. // An exclusive list of packages to be updated. These are the only packages
  313. // that will be updated. If these packages are not installed, they will be
  314. // ignored. This field cannot be specified with any other patch configuration
  315. // fields.
  316. repeated string exclusive_packages = 3;
  317. }
  318. // Yum patching is performed by executing `yum update`. Additional options
  319. // can be set to control how this is executed.
  320. //
  321. // Note that not all settings are supported on all platforms.
  322. message YumSettings {
  323. // Adds the `--security` flag to `yum update`. Not supported on
  324. // all platforms.
  325. bool security = 1;
  326. // Will cause patch to run `yum update-minimal` instead.
  327. bool minimal = 2;
  328. // List of packages to exclude from update. These packages are excluded by
  329. // using the yum `--exclude` flag.
  330. repeated string excludes = 3;
  331. // An exclusive list of packages to be updated. These are the only packages
  332. // that will be updated. If these packages are not installed, they will be
  333. // ignored. This field must not be specified with any other patch
  334. // configuration fields.
  335. repeated string exclusive_packages = 4;
  336. }
  337. // Googet patching is performed by running `googet update`.
  338. message GooSettings {
  339. }
  340. // Zypper patching is performed by running `zypper patch`.
  341. // See also https://en.opensuse.org/SDB:Zypper_manual.
  342. message ZypperSettings {
  343. // Adds the `--with-optional` flag to `zypper patch`.
  344. bool with_optional = 1;
  345. // Adds the `--with-update` flag, to `zypper patch`.
  346. bool with_update = 2;
  347. // Install only patches with these categories.
  348. // Common categories include security, recommended, and feature.
  349. repeated string categories = 3;
  350. // Install only patches with these severities.
  351. // Common severities include critical, important, moderate, and low.
  352. repeated string severities = 4;
  353. // List of patches to exclude from update.
  354. repeated string excludes = 5;
  355. // An exclusive list of patches to be updated. These are the only patches
  356. // that will be installed using 'zypper patch patch:<patch_name>' command.
  357. // This field must not be used with any other patch configuration fields.
  358. repeated string exclusive_patches = 6;
  359. }
  360. // Windows patching is performed using the Windows Update Agent.
  361. message WindowsUpdateSettings {
  362. // Microsoft Windows update classifications as defined in
  363. // [1]
  364. // https://support.microsoft.com/en-us/help/824684/description-of-the-standard-terminology-that-is-used-to-describe-micro
  365. enum Classification {
  366. // Invalid. If classifications are included, they must be specified.
  367. CLASSIFICATION_UNSPECIFIED = 0;
  368. // "A widely released fix for a specific problem that addresses a critical,
  369. // non-security-related bug." [1]
  370. CRITICAL = 1;
  371. // "A widely released fix for a product-specific, security-related
  372. // vulnerability. Security vulnerabilities are rated by their severity. The
  373. // severity rating is indicated in the Microsoft security bulletin as
  374. // critical, important, moderate, or low." [1]
  375. SECURITY = 2;
  376. // "A widely released and frequent software update that contains additions
  377. // to a product's definition database. Definition databases are often used
  378. // to detect objects that have specific attributes, such as malicious code,
  379. // phishing websites, or junk mail." [1]
  380. DEFINITION = 3;
  381. // "Software that controls the input and output of a device." [1]
  382. DRIVER = 4;
  383. // "New product functionality that is first distributed outside the context
  384. // of a product release and that is typically included in the next full
  385. // product release." [1]
  386. FEATURE_PACK = 5;
  387. // "A tested, cumulative set of all hotfixes, security updates, critical
  388. // updates, and updates. Additionally, service packs may contain additional
  389. // fixes for problems that are found internally since the release of the
  390. // product. Service packs my also contain a limited number of
  391. // customer-requested design changes or features." [1]
  392. SERVICE_PACK = 6;
  393. // "A utility or feature that helps complete a task or set of tasks." [1]
  394. TOOL = 7;
  395. // "A tested, cumulative set of hotfixes, security updates, critical
  396. // updates, and updates that are packaged together for easy deployment. A
  397. // rollup generally targets a specific area, such as security, or a
  398. // component of a product, such as Internet Information Services (IIS)." [1]
  399. UPDATE_ROLLUP = 8;
  400. // "A widely released fix for a specific problem. An update addresses a
  401. // noncritical, non-security-related bug." [1]
  402. UPDATE = 9;
  403. }
  404. // Only apply updates of these windows update classifications. If empty, all
  405. // updates are applied.
  406. repeated Classification classifications = 1;
  407. // List of KBs to exclude from update.
  408. repeated string excludes = 2;
  409. // An exclusive list of kbs to be updated. These are the only patches
  410. // that will be updated. This field must not be used with other
  411. // patch configurations.
  412. repeated string exclusive_patches = 3;
  413. }
  414. // A step that runs an executable for a PatchJob.
  415. message ExecStep {
  416. // The ExecStepConfig for all Linux VMs targeted by the PatchJob.
  417. ExecStepConfig linux_exec_step_config = 1;
  418. // The ExecStepConfig for all Windows VMs targeted by the PatchJob.
  419. ExecStepConfig windows_exec_step_config = 2;
  420. }
  421. // Common configurations for an ExecStep.
  422. message ExecStepConfig {
  423. // The interpreter used to execute the a file.
  424. enum Interpreter {
  425. // Invalid for a Windows ExecStepConfig. For a Linux ExecStepConfig, the
  426. // interpreter will be parsed from the shebang line of the script if
  427. // unspecified.
  428. INTERPRETER_UNSPECIFIED = 0;
  429. // Indicates that the script is run with `/bin/sh` on Linux and `cmd`
  430. // on Windows.
  431. SHELL = 1;
  432. // Indicates that the file is run with PowerShell flags
  433. // `-NonInteractive`, `-NoProfile`, and `-ExecutionPolicy Bypass`.
  434. POWERSHELL = 2;
  435. }
  436. // Location of the executable.
  437. oneof executable {
  438. // An absolute path to the executable on the VM.
  439. string local_path = 1;
  440. // A Google Cloud Storage object containing the executable.
  441. GcsObject gcs_object = 2;
  442. }
  443. // Defaults to [0]. A list of possible return values that the
  444. // execution can return to indicate a success.
  445. repeated int32 allowed_success_codes = 3;
  446. // The script interpreter to use to run the script. If no interpreter is
  447. // specified the script will be executed directly, which will likely
  448. // only succeed for scripts with [shebang lines]
  449. // (https://en.wikipedia.org/wiki/Shebang_\(Unix\)).
  450. Interpreter interpreter = 4;
  451. }
  452. // Google Cloud Storage object representation.
  453. message GcsObject {
  454. // Required. Bucket of the Google Cloud Storage object.
  455. string bucket = 1 [(google.api.field_behavior) = REQUIRED];
  456. // Required. Name of the Google Cloud Storage object.
  457. string object = 2 [(google.api.field_behavior) = REQUIRED];
  458. // Required. Generation number of the Google Cloud Storage object. This is used to
  459. // ensure that the ExecStep specified by this PatchJob does not change.
  460. int64 generation_number = 3 [(google.api.field_behavior) = REQUIRED];
  461. }
  462. // A filter to target VM instances for patching. The targeted
  463. // VMs must meet all criteria specified. So if both labels and zones are
  464. // specified, the patch job targets only VMs with those labels and in those
  465. // zones.
  466. message PatchInstanceFilter {
  467. // Represents a group of VMs that can be identified as having all these
  468. // labels, for example "env=prod and app=web".
  469. message GroupLabel {
  470. // Google Compute Engine instance labels that must be present for a VM
  471. // instance to be targeted by this filter.
  472. map<string, string> labels = 1;
  473. }
  474. // Target all VM instances in the project. If true, no other criteria is
  475. // permitted.
  476. bool all = 1;
  477. // Targets VM instances matching at least one of these label sets. This allows
  478. // targeting of disparate groups, for example "env=prod or env=staging".
  479. repeated GroupLabel group_labels = 2;
  480. // Targets VM instances in ANY of these zones. Leave empty to target VM
  481. // instances in any zone.
  482. repeated string zones = 3;
  483. // Targets any of the VM instances specified. Instances are specified by their
  484. // URI in the form `zones/[ZONE]/instances/[INSTANCE_NAME]`,
  485. // `projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`, or
  486. // `https://www.googleapis.com/compute/v1/projects/[PROJECT_ID]/zones/[ZONE]/instances/[INSTANCE_NAME]`
  487. repeated string instances = 4;
  488. // Targets VMs whose name starts with one of these prefixes. Similar to
  489. // labels, this is another way to group VMs when targeting configs, for
  490. // example prefix="prod-".
  491. repeated string instance_name_prefixes = 5;
  492. }