Skip to content

Commit

Permalink
Add assign credentials resource
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Oct 31, 2023
1 parent ef05fa1 commit c96e6e0
Show file tree
Hide file tree
Showing 16 changed files with 912 additions and 3 deletions.
36 changes: 36 additions & 0 deletions docs/data-sources/assign_credentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "catalystcenter_assign_credentials Data Source - terraform-provider-catalystcenter"
subcategory: "Network Settings"
description: |-
This data source can read the assigned credentials of a site.
---

# catalystcenter_assign_credentials (Data Source)

This data source can read the assigned credentials of a site.

## Example Usage

```terraform
data "catalystcenter_assign_credentials" "example" {
id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The id of the object
- `site_id` (String) The site ID

### Read-Only

- `cli_id` (String) The ID of the CLI credentials
- `https_read` (String) The ID of the HTTPS read credentials
- `https_write` (String) The ID of the HTTPS write credentials
- `snmp_v2_read_id` (String) The ID of the SNMPv2 read credentials
- `snmp_v2_write_id` (String) The ID of the SNMPv2 write credentials
- `snmp_v3_id` (String) The ID of the SNMPv3 credentials
49 changes: 49 additions & 0 deletions docs/resources/assign_credentials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "catalystcenter_assign_credentials Resource - terraform-provider-catalystcenter"
subcategory: "Network Settings"
description: |-
This resource can manage the assigned credentials of a site.
---

# catalystcenter_assign_credentials (Resource)

This resource can manage the assigned credentials of a site.

## Example Usage

```terraform
resource "catalystcenter_assign_credentials" "example" {
site_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
cli_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
https_read = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `site_id` (String) The site ID

### Optional

- `cli_id` (String) The ID of the CLI credentials
- `https_read` (String) The ID of the HTTPS read credentials
- `https_write` (String) The ID of the HTTPS write credentials
- `snmp_v2_read_id` (String) The ID of the SNMPv2 read credentials
- `snmp_v2_write_id` (String) The ID of the SNMPv2 write credentials
- `snmp_v3_id` (String) The ID of the SNMPv3 credentials

### Read-Only

- `id` (String) The id of the object

## Import

Import is supported using the following syntax:

```shell
terraform import catalystcenter_assign_credentials.example "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "catalystcenter_assign_credentials" "example" {
id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import catalystcenter_assign_credentials.example "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "catalystcenter_assign_credentials" "example" {
site_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
cli_id = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
https_read = "5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1"
}
80 changes: 80 additions & 0 deletions gen/definitions/assign_credentials.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
name: Assign Credentials
rest_endpoint: /dna/intent/api/v2/credential-to-site
get_rest_endpoint: /api/v1/commonsetting/global
get_requires_id: true
post_update: true
no_delete: true
ds_description: This data source can read the assigned credentials of a site.
res_description: This resource can manage the assigned credentials of a site.
doc_category: Network Settings
attributes:
- model_name: siteId
type: String
query_param: true
id: true
description: The site ID
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
test_value: catalystcenter_area.test.id
- model_name: cliId
response_data_path: 'response.#(key=\"credential.cli\").value.0.objReferences.0'
type: String
description: The ID of the CLI credentials
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
test_value: catalystcenter_credentials_cli.test.id
minimum_test_value: catalystcenter_credentials_cli.test.id
- model_name: snmpV2ReadId
response_data_path: 'response.#(key=\"credential.snmp_v2_read\").value.0.objReferences.0'
type: String
description: The ID of the SNMPv2 read credentials
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
exclude_test: true
- model_name: snmpV2WriteId
response_data_path: 'response.#(key=\"credential.snmp_v2_write\").value.0.objReferences.0'
type: String
description: The ID of the SNMPv2 write credentials
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
exclude_test: true
- model_name: snmpV3Id
response_data_path: 'response.#(key=\"credential.snmp_v3\").value.0.objReferences.0'
type: String
description: The ID of the SNMPv3 credentials
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
exclude_test: true
- model_name: httpRead
response_data_path: 'response.#(key=\"credential.http.read\").value.0.objReferences.0'
tf_name: https_read
type: String
description: The ID of the HTTPS read credentials
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
test_value: catalystcenter_credentials_https_read.test.id
- model_name: httpWrite
response_data_path: 'response.#(key=\"credential.http.write\").value.0.objReferences.0'
tf_name: https_write
type: String
description: The ID of the HTTPS write credentials
example: 5e6f7b3a-2b0b-4a7d-8b1c-0d4b1cd5e1b1
exclude_test: true

test_prerequisites: |
resource "catalystcenter_area" "test" {
name = "Area1"
parent_name = "Global"
depends_on = [
catalystcenter_credentials_cli.test,
catalystcenter_credentials_https_read.test,
]
}
resource "catalystcenter_credentials_cli" "test" {
description = "TestCli1"
username = "user1"
password = "password1"
}
resource "catalystcenter_credentials_https_read" "test" {
description = "TestHttpsRead1"
username = "user1"
password = "password1"
}
1 change: 1 addition & 0 deletions gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ type YamlConfig struct {
GetRestEndpoint string `yaml:"get_rest_endpoint"`
GetNoId bool `yaml:"get_no_id"`
GetFromAll bool `yaml:"get_from_all"`
GetRequiresId bool `yaml:"get_requires_id"`
NoDelete bool `yaml:"no_delete"`
PostUpdate bool `yaml:"post_update"`
RootList bool `yaml:"root_list"`
Expand Down
1 change: 1 addition & 0 deletions gen/schema/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rest_endpoint: str() # REST endpoint path
get_rest_endpoint: str(required=False) # Override GET REST endpoint path
get_no_id: bool(required=False) # Set to true if the GET request does not require an ID
get_from_all: bool(required=False) # Set to true if GET does not support querying individual objects
get_requires_id: bool(required=False) # Set to true if the GET request requires an ID in the URL path
no_delete: bool(required=False) # Set to true if the DELETE request is not supported
post_update: bool(required=False) # Set to true if the POST request is used for update
root_list: bool(required=False) # Set to true if the root element of the data structure is a list
Expand Down
2 changes: 1 addition & 1 deletion gen/templates/data_source.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions gen/templates/resource.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 136 additions & 0 deletions internal/provider/data_source_catalystcenter_assign_credentials.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c96e6e0

Please sign in to comment.