# OS Config API . projects . locations . instances . osPolicyAssignments . reports

## Instance Methods

Close httplib2 connections.

Get the OS policy assignment report for the specified Compute Engine VM instance.

List OS policy assignment reports for all Compute Engine VM instances in the specified zone.

Retrieves the next page of results.

### Method Details

`close()`

    Close httplib2 connections.

`get(name, x__xgafv=None)`

    Get the OS policy assignment report for the specified Compute Engine VM instance.

    Args:
      name: string, Required. API resource name for OS policy assignment report. Format: `/projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/report` For `{project}`, either `project-number` or `project-id` can be provided. For `{instance_id}`, either Compute Engine `instance-id` or `instance-name` can be provided. For `{assignment_id}`, the OSPolicyAssignment id must be provided. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A report of the OS policy assignment status for a given instance.
      "instance": "A String", # The Compute Engine VM instance name.
      "lastRunId": "A String", # Unique identifier of the last attempted run to apply the OS policies associated with this assignment on the VM. This ID is logged by the OS Config agent while applying the OS policies associated with this assignment on the VM. NOTE: If the service is unable to successfully connect to the agent for this run, then this id will not be available in the agent logs.
      "name": "A String", # The `OSPolicyAssignmentReport` API resource name. Format: `projects/{project_number}/locations/{location}/instances/{instance_id}/osPolicyAssignments/{os_policy_assignment_id}/report`
      "osPolicyAssignment": "A String", # Reference to the `OSPolicyAssignment` API resource that the `OSPolicy` belongs to. Format: `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}`
      "osPolicyCompliances": [ # Compliance data for each `OSPolicy` that is applied to the VM.
        { # Compliance data for an OS policy
          "complianceState": "A String", # The compliance state of the OS policy.
          "complianceStateReason": "A String", # The reason for the OS policy to be in an unknown compliance state. This field is always populated when `compliance_state` is `UNKNOWN`. If populated, the field can contain one of the following values: * `vm-not-running`: The VM was not running. * `os-policies-not-supported-by-agent`: The version of the OS Config agent running on the VM does not support running OS policies. * `no-agent-detected`: The OS Config agent is not detected for the VM. * `resource-execution-errors`: The OS Config agent encountered errors while executing one or more resources in the policy. See `os_policy_resource_compliances` for details. * `task-timeout`: The task sent to the agent to apply the policy timed out. * `unexpected-agent-state`: The OS Config agent did not report the final status of the task that attempted to apply the policy. Instead, the agent unexpectedly started working on a different task. This mostly happens when the agent or VM unexpectedly restarts while applying OS policies. * `internal-service-errors`: Internal service errors were encountered while attempting to apply the policy. * `os-policy-execution-pending`: OS policy was assigned to the given VM, but was not executed yet. Typically this is a transient condition that will go away after the next policy execution cycle.
          "osPolicyId": "A String", # The OS policy id
          "osPolicyResourceCompliances": [ # Compliance data for each resource within the policy that is applied to the VM.
            { # Compliance data for an OS policy resource.
              "complianceState": "A String", # The compliance state of the resource.
              "complianceStateReason": "A String", # A reason for the resource to be in the given compliance state. This field is always populated when `compliance_state` is `UNKNOWN`. The following values are supported when `compliance_state == UNKNOWN` * `execution-errors`: Errors were encountered by the agent while executing the resource and the compliance state couldn't be determined. * `execution-skipped-by-agent`: Resource execution was skipped by the agent because errors were encountered while executing prior resources in the OS policy. * `os-policy-execution-attempt-failed`: The execution of the OS policy containing this resource failed and the compliance state couldn't be determined. * `os-policy-execution-pending`: OS policy that owns this resource was assigned to the given VM, but was not executed yet.
              "configSteps": [ # Ordered list of configuration completed by the agent for the OS policy resource.
                { # Step performed by the OS Config agent for configuring an `OSPolicy` resource to its desired state.
                  "errorMessage": "A String", # An error message recorded during the execution of this step. Only populated if errors were encountered during this step execution.
                  "type": "A String", # Configuration step type.
                },
              ],
              "execResourceOutput": { # ExecResource specific output. # ExecResource specific output.
                "enforcementOutput": "A String", # Output from enforcement phase output file (if run). Output size is limited to 100K bytes.
              },
              "osPolicyResourceId": "A String", # The ID of the OS policy resource.
            },
          ],
        },
      ],
      "updateTime": "A String", # Timestamp for when the report was last generated.
    }

`list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)`

    List OS policy assignment reports for all Compute Engine VM instances in the specified zone.

    Args:
      parent: string, Required. The parent resource name. Format: `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/{assignment}/reports` For `{project}`, either `project-number` or `project-id` can be provided. For `{instance}`, either `instance-name`, `instance-id`, or `-` can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all instances in the project/location. For `{assignment}`, either `assignment-id` or `-` can be provided. If '-' is provided, the response will include OSPolicyAssignmentReports for all OSPolicyAssignments in the project/location. Either {instance} or {assignment} must be `-`. For example: `projects/{project}/locations/{location}/instances/{instance}/osPolicyAssignments/-/reports` returns all reports for the instance `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/{assignment-id}/reports` returns all the reports for the given assignment across all instances. `projects/{project}/locations/{location}/instances/-/osPolicyAssignments/-/reports` returns all the reports for all assignments across all instances. (required)
      filter: string, If provided, this field specifies the criteria that must be met by the `OSPolicyAssignmentReport` API resource that is included in the response.
      pageSize: integer, The maximum number of results to return.
      pageToken: string, A pagination token returned from a previous call to the `ListOSPolicyAssignmentReports` method that indicates where this listing should continue from.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A response message for listing OS Policy assignment reports including the page of results and page token.
      "nextPageToken": "A String", # The pagination token to retrieve the next page of OS policy assignment report objects.
      "osPolicyAssignmentReports": [ # List of OS policy assignment reports.
        { # A report of the OS policy assignment status for a given instance.
          "instance": "A String", # The Compute Engine VM instance name.
          "lastRunId": "A String", # Unique identifier of the last attempted run to apply the OS policies associated with this assignment on the VM. This ID is logged by the OS Config agent while applying the OS policies associated with this assignment on the VM. NOTE: If the service is unable to successfully connect to the agent for this run, then this id will not be available in the agent logs.
          "name": "A String", # The `OSPolicyAssignmentReport` API resource name. Format: `projects/{project_number}/locations/{location}/instances/{instance_id}/osPolicyAssignments/{os_policy_assignment_id}/report`
          "osPolicyAssignment": "A String", # Reference to the `OSPolicyAssignment` API resource that the `OSPolicy` belongs to. Format: `projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id@revision_id}`
          "osPolicyCompliances": [ # Compliance data for each `OSPolicy` that is applied to the VM.
            { # Compliance data for an OS policy
              "complianceState": "A String", # The compliance state of the OS policy.
              "complianceStateReason": "A String", # The reason for the OS policy to be in an unknown compliance state. This field is always populated when `compliance_state` is `UNKNOWN`. If populated, the field can contain one of the following values: * `vm-not-running`: The VM was not running. * `os-policies-not-supported-by-agent`: The version of the OS Config agent running on the VM does not support running OS policies. * `no-agent-detected`: The OS Config agent is not detected for the VM. * `resource-execution-errors`: The OS Config agent encountered errors while executing one or more resources in the policy. See `os_policy_resource_compliances` for details. * `task-timeout`: The task sent to the agent to apply the policy timed out. * `unexpected-agent-state`: The OS Config agent did not report the final status of the task that attempted to apply the policy. Instead, the agent unexpectedly started working on a different task. This mostly happens when the agent or VM unexpectedly restarts while applying OS policies. * `internal-service-errors`: Internal service errors were encountered while attempting to apply the policy. * `os-policy-execution-pending`: OS policy was assigned to the given VM, but was not executed yet. Typically this is a transient condition that will go away after the next policy execution cycle.
              "osPolicyId": "A String", # The OS policy id
              "osPolicyResourceCompliances": [ # Compliance data for each resource within the policy that is applied to the VM.
                { # Compliance data for an OS policy resource.
                  "complianceState": "A String", # The compliance state of the resource.
                  "complianceStateReason": "A String", # A reason for the resource to be in the given compliance state. This field is always populated when `compliance_state` is `UNKNOWN`. The following values are supported when `compliance_state == UNKNOWN` * `execution-errors`: Errors were encountered by the agent while executing the resource and the compliance state couldn't be determined. * `execution-skipped-by-agent`: Resource execution was skipped by the agent because errors were encountered while executing prior resources in the OS policy. * `os-policy-execution-attempt-failed`: The execution of the OS policy containing this resource failed and the compliance state couldn't be determined. * `os-policy-execution-pending`: OS policy that owns this resource was assigned to the given VM, but was not executed yet.
                  "configSteps": [ # Ordered list of configuration completed by the agent for the OS policy resource.
                    { # Step performed by the OS Config agent for configuring an `OSPolicy` resource to its desired state.
                      "errorMessage": "A String", # An error message recorded during the execution of this step. Only populated if errors were encountered during this step execution.
                      "type": "A String", # Configuration step type.
                    },
                  ],
                  "execResourceOutput": { # ExecResource specific output. # ExecResource specific output.
                    "enforcementOutput": "A String", # Output from enforcement phase output file (if run). Output size is limited to 100K bytes.
                  },
                  "osPolicyResourceId": "A String", # The ID of the OS policy resource.
                },
              ],
            },
          ],
          "updateTime": "A String", # Timestamp for when the report was last generated.
        },
      ],
    }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.