# Registry Token

## registry\_token

This is a module that supports creating, updating or destroying Registry Tokens

### Example Syntax

```yaml

name: Create Registry Token
ionoscloudsdk.ionoscloud.registry_token:
  registry: ''
  name: testRegistryToken
  scopes:
  - actions:
    - pull
    - push
    name: nume
    type: repository
  status: enabled
register: registry_token_response


name: Update Registry Token
ionoscloudsdk.ionoscloud.registry_token:
  registry: ''
  registry_token: ''
  scopes:
  - actions:
    - pull
    - push
    - delete
    name: nume
    type: repo1
  status: disabled
  allow_replace: false
  state: update
register: registry_token_response


name: Delete Registry Token
ionoscloudsdk.ionoscloud.registry_token:
  registry: ''
  registry_token: ''
  state: absent
register: registry_token_response

```

&#x20; &#x20;

### Returned object

```json
{
    "changed": true,
    "failed": false,
    "action": "create",
    "registry_token": {
        "href": "",
        "id": "1e9f63b6-ff23-41ab-8f7e-57dd1008d6b5",
        "metadata": {
            "created_by": "<USER_EMAIL>",
            "created_by_user_id": "<USER_ID>",
            "created_date": "2023-05-29T13:51:29+00:00",
            "last_modified_by": null,
            "last_modified_by_user_id": null,
            "last_modified_date": null,
            "state": "enabled"
        },
        "properties": {
            "credentials": {
                "password": "<PASSWORD>",
                "username": "testRegistryToken"
            },
            "expiry_date": null,
            "name": "testRegistryToken",
            "scopes": [
                {
                    "actions": [
                        "pull",
                        "push"
                    ],
                    "name": "nume",
                    "type": "repo"
                }
            ],
            "status": "enabled"
        },
        "type": "token"
    }
}

```

#### For more examples please check out the tests [here](https://github.com/ionos-cloud/module-ansible/tree/master/tests/container-registry).

&#x20;

***NOTE:*** **If you are using a versions 7.0.0 and up**: modules can replace resources if certain set parameters differ from the results found in the API!

### Parameters that can trigger a resource replacement:

* name &#x20;

## state: **present**

```yaml
  
name: Create Registry Token
ionoscloudsdk.ionoscloud.registry_token:
  registry: ''
  name: testRegistryToken
  scopes:
  - actions:
    - pull
    - push
    name: nume
    type: repository
  status: enabled
register: registry_token_response

```

#### Available parameters for state **present**:

&#x20;

<table data-full-width="true"><thead><tr><th width="70">Name</th><th width="40" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>scopes<br><mark style="color:blue;">list</mark></td><td align="center">False</td><td>List of scopes for the token</td></tr><tr><td>expiry_date<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The expiry date for the token in iso format</td></tr><tr><td>status<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The status of the token</td></tr><tr><td>name<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The name of your token.</td></tr><tr><td>registry<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The ID or name of an existing Registry.</td></tr><tr><td>allow_replace<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br>Default: False</td></tr><tr><td>api_url<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API base URL.</td></tr><tr><td>certificate_fingerprint<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API certificate fingerprint.</td></tr><tr><td>username<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos username. Overrides the IONOS_USERNAME environment variable.</td></tr><tr><td>password<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos password. Overrides the IONOS_PASSWORD environment variable.</td></tr><tr><td>token<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos token. Overrides the IONOS_TOKEN environment variable.</td></tr><tr><td>wait<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Wait for the resource to be created before returning.<br>Default: True<br>Options: [True, False]</td></tr><tr><td>wait_timeout<br><mark style="color:blue;">int</mark></td><td align="center">False</td><td>How long before wait gives up, in seconds.<br>Default: 600</td></tr><tr><td>state<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>Indicate desired state of the resource.<br>Default: present<br>Options: ['present', 'absent', 'update']</td></tr></tbody></table>

&#x20;

&#x20;

## state: **absent**

```yaml
  
name: Delete Registry Token
ionoscloudsdk.ionoscloud.registry_token:
  registry: ''
  registry_token: ''
  state: absent
register: registry_token_response

```

#### Available parameters for state **absent**:

&#x20;

<table data-full-width="true"><thead><tr><th width="70">Name</th><th width="40" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>registry_token<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The ID or name of an existing token.</td></tr><tr><td>registry<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The ID or name of an existing Registry.</td></tr><tr><td>api_url<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API base URL.</td></tr><tr><td>certificate_fingerprint<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API certificate fingerprint.</td></tr><tr><td>username<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos username. Overrides the IONOS_USERNAME environment variable.</td></tr><tr><td>password<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos password. Overrides the IONOS_PASSWORD environment variable.</td></tr><tr><td>token<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos token. Overrides the IONOS_TOKEN environment variable.</td></tr><tr><td>wait<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Wait for the resource to be created before returning.<br>Default: True<br>Options: [True, False]</td></tr><tr><td>wait_timeout<br><mark style="color:blue;">int</mark></td><td align="center">False</td><td>How long before wait gives up, in seconds.<br>Default: 600</td></tr><tr><td>state<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>Indicate desired state of the resource.<br>Default: present<br>Options: ['present', 'absent', 'update']</td></tr></tbody></table>

&#x20;

&#x20;

## state: **update**

```yaml
  
name: Update Registry Token
ionoscloudsdk.ionoscloud.registry_token:
  registry: ''
  registry_token: ''
  scopes:
  - actions:
    - pull
    - push
    - delete
    name: nume
    type: repo1
  status: disabled
  allow_replace: false
  state: update
register: registry_token_response

```

#### Available parameters for state **update**:

&#x20;

<table data-full-width="true"><thead><tr><th width="70">Name</th><th width="40" align="center">Required</th><th>Description</th></tr></thead><tbody><tr><td>scopes<br><mark style="color:blue;">list</mark></td><td align="center">False</td><td>List of scopes for the token</td></tr><tr><td>expiry_date<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The expiry date for the token in iso format</td></tr><tr><td>status<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The status of the token</td></tr><tr><td>name<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The name of your token.</td></tr><tr><td>registry_token<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The ID or name of an existing token.</td></tr><tr><td>registry<br><mark style="color:blue;">str</mark></td><td align="center">True</td><td>The ID or name of an existing Registry.</td></tr><tr><td>allow_replace<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Boolean indicating if the resource should be recreated when the state cannot be reached in another way. This may be used to prevent resources from being deleted from specifying a different value to an immutable property. An error will be thrown instead<br>Default: False</td></tr><tr><td>api_url<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API base URL.</td></tr><tr><td>certificate_fingerprint<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos API certificate fingerprint.</td></tr><tr><td>username<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos username. Overrides the IONOS_USERNAME environment variable.</td></tr><tr><td>password<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos password. Overrides the IONOS_PASSWORD environment variable.</td></tr><tr><td>token<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>The Ionos token. Overrides the IONOS_TOKEN environment variable.</td></tr><tr><td>wait<br><mark style="color:blue;">bool</mark></td><td align="center">False</td><td>Wait for the resource to be created before returning.<br>Default: True<br>Options: [True, False]</td></tr><tr><td>wait_timeout<br><mark style="color:blue;">int</mark></td><td align="center">False</td><td>How long before wait gives up, in seconds.<br>Default: 600</td></tr><tr><td>state<br><mark style="color:blue;">str</mark></td><td align="center">False</td><td>Indicate desired state of the resource.<br>Default: present<br>Options: ['present', 'absent', 'update']</td></tr></tbody></table>

&#x20;

&#x20;
