# Google Cloud OS Config v1alpha API - Class OSPolicyAssignment (2.0.0-alpha07)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.0.0-alpha07 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment)
- [2.0.0-alpha06](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/2.0.0-alpha06/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment)
- [1.0.0-alpha04](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/1.0.0-alpha04/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment)

    public sealed class OSPolicyAssignment : IMessage<OSPolicyAssignment>, IEquatable<OSPolicyAssignment>, IDeepCloneable<OSPolicyAssignment>, IBufferMessage, IMessage

Reference documentation and code samples for the Google Cloud OS Config v1alpha API class OSPolicyAssignment.

OS policy assignment is an API resource that is used to
apply a set of OS policies to a dynamically targeted group of Compute Engine
VM instances.

An OS policy is used to define the desired state configuration for a
Compute Engine VM instance through a set of configuration resources that
provide capabilities such as installing or removing software packages, or
executing a script.

For more information, see [OS policy and OS policy
assignment](https://cloud.google.com/compute/docs/os-configuration-management/working-with-os-policies).

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> OSPolicyAssignment

## Implements

[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[OSPolicyAssignment](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[OSPolicyAssignment](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[OSPolicyAssignment](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html)

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.OsConfig.V1Alpha](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha)

## Assembly

Google.Cloud.OsConfig.V1Alpha.dll

## Constructors

### OSPolicyAssignment()

    public OSPolicyAssignment()

### OSPolicyAssignment(OSPolicyAssignment)

    public OSPolicyAssignment(OSPolicyAssignment other)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `other` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment` |

## Properties

### Baseline

    public bool Baseline { get; set; }

Output only. Indicates that this revision has been successfully rolled out in this zone
and new VMs will be assigned OS policies from this revision.

For a given OS policy assignment, there is only one revision with a value
of `true` for this field.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### Deleted

    public bool Deleted { get; set; }

Output only. Indicates that this revision deletes the OS policy assignment.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### Description

    public string Description { get; set; }

OS policy assignment description.
Length of the description is limited to 1024 characters.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Etag

    public string Etag { get; set; }

The etag for this OS policy assignment.
If this is provided on update, it must match the server's etag.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### InstanceFilter

    public OSPolicyAssignment.Types.InstanceFilter InstanceFilter { get; set; }

Required. Filter to select VMs.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignmenthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment.Types.InstanceFilter` |   |

### Name

    public string Name { get; set; }

Resource name.

Format:
`projects/{project_number}/locations/{location}/osPolicyAssignments/{os_policy_assignment_id}`

This field is ignored when you create an OS policy assignment.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### OSPolicyAssignmentName

    public OSPolicyAssignmentName OSPolicyAssignmentName { get; set; }

[OSPolicyAssignmentName](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignmentName)-typed view over the [Name](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment#Google_Cloud_OsConfig_V1Alpha_OSPolicyAssignment_Name) resource name property.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignmentName` |   |

### OsPolicies

    public RepeatedField<OSPolicy> OsPolicies { get; }

Required. List of OS policies to be applied to the VMs.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.Collections.RepeatedField-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicy` |   |

### Reconciling

    public bool Reconciling { get; set; }

Output only. Indicates that reconciliation is in progress for the revision.
This value is `true` when the `rollout_state` is one of:

- IN_PROGRESS
- CANCELLING

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.boolean` |   |

### RevisionCreateTime

    public Timestamp RevisionCreateTime { get; set; }

Output only. The timestamp that the revision was created.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.WellKnownTypes.Timestamp.html` |   |

### RevisionId

    public string RevisionId { get; set; }

Output only. The assignment revision ID
A new revision is committed whenever a rollout is triggered for a OS policy
assignment

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### Rollout

    public OSPolicyAssignment.Types.Rollout Rollout { get; set; }

Required. Rollout to deploy the OS policy assignment.
A rollout is triggered in the following situations:
1) OSPolicyAssignment is created.
2) OSPolicyAssignment is updated and the update contains changes to one of
the following fields:

- instance_filter
- os_policies 3) OSPolicyAssignment is deleted.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignmenthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment.Types.Rollout` |   |

### RolloutState

    public OSPolicyAssignment.Types.RolloutState RolloutState { get; set; }

Output only. OS policy assignment rollout state

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignmenthttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment.Typeshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OsConfig.V1Alpha/latest/Google.Cloud.OsConfig.V1Alpha.OSPolicyAssignment.Types.RolloutState` |   |

### Uid

    public string Uid { get; set; }

Output only. Server generated unique id for the OS policy assignment resource.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |