os_policy_assignment_reports.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. // Copyright 2021 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.v1alpha;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option csharp_namespace = "Google.Cloud.OsConfig.V1Alpha";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha;osconfig";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "OSPolicyAssignmentReportsProto";
  23. option java_package = "com.google.cloud.osconfig.v1alpha";
  24. option php_namespace = "Google\\Cloud\\OsConfig\\V1alpha";
  25. option ruby_package = "Google::Cloud::OsConfig::V1alpha";
  26. option (google.api.resource_definition) = {
  27. type: "compute.googleapis.com/InstanceOSPolicyAssignment"
  28. pattern: "projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}"
  29. };
  30. // Get a report of the OS policy assignment for a VM instance.
  31. message GetOSPolicyAssignmentReportRequest {
  32. // Required. API resource name for OS policy assignment report.
  33. //
  34. // Format:
  35. // `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report`
  36. //
  37. // For `{project}`, either `project-number` or `project-id` can be provided.
  38. // For `{instance_id}`, either Compute Engine `instance-id` or `instance-name`
  39. // can be provided.
  40. // For `{assignment_id}`, the OSPolicyAssignment id must be provided.
  41. string name = 1 [
  42. (google.api.field_behavior) = REQUIRED,
  43. (google.api.resource_reference) = {
  44. type: "osconfig.googleapis.com/OSPolicyAssignmentReport"
  45. }
  46. ];
  47. }
  48. // List the OS policy assignment reports for VM instances.
  49. message ListOSPolicyAssignmentReportsRequest {
  50. // Required. The parent resource name.
  51. //
  52. // Format:
  53. // `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports`
  54. //
  55. // For `{project}`, either `project-number` or `project-id` can be provided.
  56. // For `{instance}`, either `instance-name`, `instance-id`, or `-` can be
  57. // provided. If '-' is provided, the response will include
  58. // OSPolicyAssignmentReports for all instances in the project/location.
  59. // For `{assignment}`, either `assignment-id` or `-` can be provided. If '-'
  60. // is provided, the response will include OSPolicyAssignmentReports for all
  61. // OSPolicyAssignments in the project/location.
  62. // Either {instance} or {assignment} must be `-`.
  63. //
  64. // For example:
  65. // `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports`
  66. // returns all reports for the instance
  67. // `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports`
  68. // returns all the reports for the given assignment across all instances.
  69. // `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports`
  70. // returns all the reports for all assignments across all instances.
  71. string parent = 1 [
  72. (google.api.field_behavior) = REQUIRED,
  73. (google.api.resource_reference) = {
  74. type: "compute.googleapis.com/InstanceOSPolicyAssignment"
  75. }
  76. ];
  77. // The maximum number of results to return.
  78. int32 page_size = 2;
  79. // If provided, this field specifies the criteria that must be met by the
  80. // `OSPolicyAssignmentReport` API resource that is included in the response.
  81. string filter = 3;
  82. // A pagination token returned from a previous call to the
  83. // `ListOSPolicyAssignmentReports` method that indicates where this listing
  84. // should continue from.
  85. string page_token = 4;
  86. }
  87. // A response message for listing OS Policy assignment reports including the
  88. // page of results and page token.
  89. message ListOSPolicyAssignmentReportsResponse {
  90. // List of OS policy assignment reports.
  91. repeated OSPolicyAssignmentReport os_policy_assignment_reports = 1;
  92. // The pagination token to retrieve the next page of OS policy assignment
  93. // report objects.
  94. string next_page_token = 2;
  95. }
  96. // A report of the OS policy assignment status for a given instance.
  97. message OSPolicyAssignmentReport {
  98. option (google.api.resource) = {
  99. type: "osconfig.googleapis.com/OSPolicyAssignmentReport"
  100. pattern: "projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report"
  101. };
  102. // Compliance data for an OS policy
  103. message OSPolicyCompliance {
  104. // Possible compliance states for an os policy.
  105. enum ComplianceState {
  106. // The policy is in an unknown compliance state.
  107. //
  108. // Refer to the field `compliance_state_reason` to learn the exact reason
  109. // for the policy to be in this compliance state.
  110. UNKNOWN = 0;
  111. // Policy is compliant.
  112. //
  113. // The policy is compliant if all the underlying resources are also
  114. // compliant.
  115. COMPLIANT = 1;
  116. // Policy is non-compliant.
  117. //
  118. // The policy is non-compliant if one or more underlying resources are
  119. // non-compliant.
  120. NON_COMPLIANT = 2;
  121. }
  122. // Compliance data for an OS policy resource.
  123. message OSPolicyResourceCompliance {
  124. // Step performed by the OS Config agent for configuring an
  125. // `OSPolicy` resource to its desired state.
  126. message OSPolicyResourceConfigStep {
  127. // Supported configuration step types
  128. enum Type {
  129. // Default value. This value is unused.
  130. TYPE_UNSPECIFIED = 0;
  131. // Checks for resource conflicts such as schema errors.
  132. VALIDATION = 1;
  133. // Checks the current status of the desired state for a resource.
  134. DESIRED_STATE_CHECK = 2;
  135. // Enforces the desired state for a resource that is not in desired
  136. // state.
  137. DESIRED_STATE_ENFORCEMENT = 3;
  138. // Re-checks the status of the desired state. This check is done
  139. // for a resource after the enforcement of all OS policies.
  140. //
  141. // This step is used to determine the final desired state status for
  142. // the resource. It accounts for any resources that might have drifted
  143. // from their desired state due to side effects from executing other
  144. // resources.
  145. DESIRED_STATE_CHECK_POST_ENFORCEMENT = 4;
  146. }
  147. // Configuration step type.
  148. Type type = 1;
  149. // An error message recorded during the execution of this step.
  150. // Only populated if errors were encountered during this step execution.
  151. string error_message = 2;
  152. }
  153. // Possible compliance states for a resource.
  154. enum ComplianceState {
  155. // The resource is in an unknown compliance state.
  156. //
  157. // To get more details about why the policy is in this state, review
  158. // the output of the `compliance_state_reason` field.
  159. UNKNOWN = 0;
  160. // Resource is compliant.
  161. COMPLIANT = 1;
  162. // Resource is non-compliant.
  163. NON_COMPLIANT = 2;
  164. }
  165. // ExecResource specific output.
  166. message ExecResourceOutput {
  167. // Output from enforcement phase output file (if run).
  168. // Output size is limited to 100K bytes.
  169. bytes enforcement_output = 2;
  170. }
  171. // The ID of the OS policy resource.
  172. string os_policy_resource_id = 1;
  173. // Ordered list of configuration completed by the agent for the OS policy
  174. // resource.
  175. repeated OSPolicyResourceConfigStep config_steps = 2;
  176. // The compliance state of the resource.
  177. ComplianceState compliance_state = 3;
  178. // A reason for the resource to be in the given compliance state.
  179. // This field is always populated when `compliance_state` is `UNKNOWN`.
  180. //
  181. // The following values are supported when `compliance_state == UNKNOWN`
  182. //
  183. // * `execution-errors`: Errors were encountered by the agent while
  184. // executing the resource and the compliance state couldn't be
  185. // determined.
  186. // * `execution-skipped-by-agent`: Resource execution was skipped by the
  187. // agent because errors were encountered while executing prior resources
  188. // in the OS policy.
  189. // * `os-policy-execution-attempt-failed`: The execution of the OS policy
  190. // containing this resource failed and the compliance state couldn't be
  191. // determined.
  192. string compliance_state_reason = 4;
  193. // Resource specific output.
  194. oneof output {
  195. // ExecResource specific output.
  196. ExecResourceOutput exec_resource_output = 5;
  197. }
  198. }
  199. // The OS policy id
  200. string os_policy_id = 1;
  201. // The compliance state of the OS policy.
  202. ComplianceState compliance_state = 2;
  203. // The reason for the OS policy to be in an unknown compliance state.
  204. // This field is always populated when `compliance_state` is `UNKNOWN`.
  205. //
  206. // If populated, the field can contain one of the following values:
  207. //
  208. // * `vm-not-running`: The VM was not running.
  209. // * `os-policies-not-supported-by-agent`: The version of the OS Config
  210. // agent running on the VM does not support running OS policies.
  211. // * `no-agent-detected`: The OS Config agent is not detected for the VM.
  212. // * `resource-execution-errors`: The OS Config agent encountered errors
  213. // while executing one or more resources in the policy. See
  214. // `os_policy_resource_compliances` for details.
  215. // * `task-timeout`: The task sent to the agent to apply the policy timed
  216. // out.
  217. // * `unexpected-agent-state`: The OS Config agent did not report the final
  218. // status of the task that attempted to apply the policy. Instead, the agent
  219. // unexpectedly started working on a different task. This mostly happens
  220. // when the agent or VM unexpectedly restarts while applying OS policies.
  221. // * `internal-service-errors`: Internal service errors were encountered
  222. // while attempting to apply the policy.
  223. string compliance_state_reason = 3;
  224. // Compliance data for each resource within the policy that is applied to
  225. // the VM.
  226. repeated OSPolicyResourceCompliance os_policy_resource_compliances = 4;
  227. }
  228. // The `OSPolicyAssignmentReport` API resource name.
  229. //
  230. // Format:
  231. // `projects/{project_number}/locations/{location}/instances/{instance_id}/osPolicyAssignments/{os_policy_assignment_id}/report`
  232. string name = 1;
  233. // The Compute Engine VM instance name.
  234. string instance = 2;
  235. // Reference to the `OSPolicyAssignment` API resource that the `OSPolicy`
  236. // belongs to.
  237. //
  238. // Format:
  239. // `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}`
  240. string os_policy_assignment = 3 [(google.api.resource_reference) = {
  241. type: "osconfig.googleapis.com/OSPolicyAssignment"
  242. }];
  243. // Compliance data for each `OSPolicy` that is applied to the VM.
  244. repeated OSPolicyCompliance os_policy_compliances = 4;
  245. // Timestamp for when the report was last generated.
  246. google.protobuf.Timestamp update_time = 5;
  247. // Unique identifier of the last attempted run to apply the OS policies
  248. // associated with this assignment on the VM.
  249. //
  250. // This ID is logged by the OS Config agent while applying the OS
  251. // policies associated with this assignment on the VM.
  252. // NOTE: If the service is unable to successfully connect to the agent for
  253. // this run, then this id will not be available in the agent logs.
  254. string last_run_id = 6;
  255. }