# Cloud OS Config V1 API - Class Google::Cloud::OsConfig::V1::OSPolicy::Resource (v1.9.0)

1.9.0 (latest) 1.8.1 1.7.0 1.6.1 1.5.0 1.4.0 1.3.0 1.2.1 1.1.0 1.0.1 0.16.0 0.15.2 0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.1 Reference documentation and code samples for the Cloud OS Config V1 API class Google::Cloud::OsConfig::V1::OSPolicy::Resource.

An OS policy resource is used to define the desired state configuration
and provides a specific functionality like installing/removing packages,
executing a script etc.


<br />

The system ensures that resources are always in their desired state by
taking necessary actions if they have drifted from their desired state.

## Inherits

- Object

## Extended By

- Google::Protobuf::MessageExts::ClassMethods

## Includes

- Google::Protobuf::MessageExts

## Methods

### #exec

    def exec() -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::ExecResource

**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::ExecResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-ExecResource)) --- Exec resource


  Note: The following fields are mutually exclusive: `exec`, `pkg`, `repository`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #exec=

    def exec=(value) -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::ExecResource

**Parameter**

- **value** ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::ExecResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-ExecResource)) --- Exec resource


  Note: The following fields are mutually exclusive: `exec`, `pkg`, `repository`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::ExecResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-ExecResource)) --- Exec resource


  Note: The following fields are mutually exclusive: `exec`, `pkg`, `repository`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #file

    def file() -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::FileResource

**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::FileResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-FileResource)) --- File resource


  Note: The following fields are mutually exclusive: `file`, `pkg`, `repository`, `exec`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #file=

    def file=(value) -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::FileResource

**Parameter**

- **value** ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::FileResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-FileResource)) --- File resource


  Note: The following fields are mutually exclusive: `file`, `pkg`, `repository`, `exec`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::FileResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-FileResource)) --- File resource


  Note: The following fields are mutually exclusive: `file`, `pkg`, `repository`, `exec`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #id

    def id() -> ::String

**Returns**

- (::String) --- Required. The id of the resource with the following restrictions:

  - Must contain only lowercase letters, numbers, and hyphens.
  - Must start with a letter.
  - Must be between 1-63 characters.
  - Must end with a number or a letter.
  - Must be unique within the OS policy.

### #id=

    def id=(value) -> ::String

**Parameter**

- **value** (::String) ---

  Required. The id of the resource with the following restrictions:
  - Must contain only lowercase letters, numbers, and hyphens.
  - Must start with a letter.
  - Must be between 1-63 characters.
  - Must end with a number or a letter.
  - Must be unique within the OS policy.
**Returns**

- (::String) --- Required. The id of the resource with the following restrictions:

  - Must contain only lowercase letters, numbers, and hyphens.
  - Must start with a letter.
  - Must be between 1-63 characters.
  - Must end with a number or a letter.
  - Must be unique within the OS policy.

### #pkg

    def pkg() -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::PackageResource

**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::PackageResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-PackageResource)) --- Package resource


  Note: The following fields are mutually exclusive: `pkg`, `repository`, `exec`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #pkg=

    def pkg=(value) -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::PackageResource

**Parameter**

- **value** ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::PackageResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-PackageResource)) --- Package resource


  Note: The following fields are mutually exclusive: `pkg`, `repository`, `exec`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::PackageResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-PackageResource)) --- Package resource


  Note: The following fields are mutually exclusive: `pkg`, `repository`, `exec`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #repository

    def repository() -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::RepositoryResource

**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::RepositoryResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-RepositoryResource)) --- Package repository resource


  Note: The following fields are mutually exclusive: `repository`, `pkg`, `exec`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.

### #repository=

    def repository=(value) -> ::Google::Cloud::OsConfig::V1::OSPolicy::Resource::RepositoryResource

**Parameter**

- **value** ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::RepositoryResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-RepositoryResource)) --- Package repository resource


  Note: The following fields are mutually exclusive: `repository`, `pkg`, `exec`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.
**Returns**

- ([::Google::Cloud::OsConfig::V1::OSPolicy::Resource::RepositoryResource](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-os_config-v1/latest/Google-Cloud-OsConfig-V1-OSPolicy-Resource-RepositoryResource)) --- Package repository resource


  Note: The following fields are mutually exclusive: `repository`, `pkg`, `exec`, `file`. If a field in that set is populated, all other fields in the set will automatically be cleared.