# Google Cloud OsConfig V1 Client - Class AptRepository (2.2.3)

2.2.3 (latest) 2.2.2 2.1.0 2.0.5 1.3.5 1.2.2 1.1.1 1.0.5 Reference documentation and code samples for the Google Cloud OsConfig V1 Client class AptRepository.

Represents a single apt package repository. These will be added to
a repo file that will be managed at
`/etc/apt/sources.list.d/google_osconfig.list`.

Generated from protobuf message `google.cloud.osconfig.v1.OSPolicy.Resource.RepositoryResource.AptRepository`

## Namespace

Google \\ Cloud \\ OsConfig \\ V1 \\ OSPolicy \\ Resource \\ RepositoryResource

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ archive_type` | `int` Required. Type of archive files in this repository. |
| `↳ uri` | `string` Required. URI for this repository. |
| `↳ distribution` | `string` Required. Distribution of this repository. |
| `↳ components` | `string[]` Required. List of components for this repository. Must contain at least one item. |
| `↳ gpg_key` | `string` URI of the key file for this repository. The agent maintains a keyring at `/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`. |

### getArchiveType

Required. Type of archive files in this repository.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ArchiveType](https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicy.Resource.RepositoryResource.AptRepository.ArchiveType). |

### setArchiveType

Required. Type of archive files in this repository.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ArchiveType](https://docs.cloud.google.com/php/docs/reference/cloud-osconfig/latest/V1.OSPolicy.Resource.RepositoryResource.AptRepository.ArchiveType). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUri

Required. URI for this repository.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setUri

Required. URI for this repository.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDistribution

Required. Distribution of this repository.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDistribution

Required. Distribution of this repository.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getComponents

Required. List of components for this repository. Must contain at
least one item.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setComponents

Required. List of components for this repository. Must contain at
least one item.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGpgKey

URI of the key file for this repository. The agent maintains a
keyring at `/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setGpgKey

URI of the key file for this repository. The agent maintains a
keyring at `/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |