-
Notifications
You must be signed in to change notification settings - Fork 14
Tags to template #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
danischm
merged 20 commits into
CiscoDevNet:main
from
kuba-mazurkiewicz:tags_to_template
Aug 5, 2024
Merged
Tags to template #105
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c95fc8e
added GenerateQueryParamString templating helper function
kuba-mazurkiewicz b853a94
use create_query_path instead of query_param in Create and Update fun…
kuba-mazurkiewicz d0e2c6f
add query_param_no_body and data_source_no_id attributes
kuba-mazurkiewicz c1381fd
add import_no_id attribute, if import does not require and ID
kuba-mazurkiewicz a98ad26
add anycast_gateway
kuba-mazurkiewicz 5545db0
update changelog
kuba-mazurkiewicz 9c69bd5
add transitPeerNetworkId as id to transit_peer_network resource
kuba-mazurkiewicz c70bd2a
updated changelog
kuba-mazurkiewicz 38d93bf
add fabric_l3_handoff_ip_transit resource and data source
kuba-mazurkiewicz 59173f3
add fabric_device resource and data source
kuba-mazurkiewicz 522d49c
pnp bulk import
kuba-mazurkiewicz 30854ad
update changelog
kuba-mazurkiewicz 9a6533c
rename pnp_device_import to pnp_import_devices
kuba-mazurkiewicz 35565f0
add tag and assign_templates_to_tag
kuba-mazurkiewicz 241fe0a
changed template_ids from List to Set
kuba-mazurkiewicz 2db5bce
update changelog
kuba-mazurkiewicz 9f31f09
Merge branch 'main' into tags_to_template
kuba-mazurkiewicz df90953
update changelog
kuba-mazurkiewicz c8291fd
modified res_description
kuba-mazurkiewicz 6333f8e
minor modifications to tag resource
kuba-mazurkiewicz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "catalystcenter_assign_templates_to_tag Data Source - terraform-provider-catalystcenter" | ||
subcategory: "Tags" | ||
description: |- | ||
This data source can read the Assign Templates to Tag. | ||
--- | ||
|
||
# catalystcenter_assign_templates_to_tag (Data Source) | ||
|
||
This data source can read the Assign Templates to Tag. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "catalystcenter_assign_templates_to_tag" "example" { | ||
tag_id = "ea505070-6bb8-493f-bff0-8058e8e03ee5" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `tag_id` (String) Tag Id to be associated with the template | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The id of the object | ||
- `template_ids` (Set of String) Template Ids List |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "catalystcenter_tag Data Source - terraform-provider-catalystcenter" | ||
subcategory: "Tags" | ||
description: |- | ||
This data source can read the Tag. | ||
--- | ||
|
||
# catalystcenter_tag (Data Source) | ||
|
||
This data source can read the Tag. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "catalystcenter_tag" "example" { | ||
name = "Tag1" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) | ||
|
||
### Read-Only | ||
|
||
- `description` (String) Description of the tag | ||
- `dynamic_rules` (Attributes List) Dynamic rules details (see [below for nested schema](#nestedatt--dynamic_rules)) | ||
- `id` (String) The id of the object | ||
- `system_tag` (Boolean) true for system created tags, false for user defined tag | ||
|
||
<a id="nestedatt--dynamic_rules"></a> | ||
### Nested Schema for `dynamic_rules` | ||
|
||
Read-Only: | ||
|
||
- `member_type` (String) memberType of the tag (e.g. networkdevice, interface) | ||
- `rule_items` (Attributes List) items details, multiple rules can be defined by items (see [below for nested schema](#nestedatt--dynamic_rules--rule_items)) | ||
- `rule_name` (String) Name of the parameter (e.g. for interface:portName,adminStatus,speed,status,description. for networkdevice:family,series,hostname,managementIpAddress,groupNameHierarchy,softwareVersion) | ||
- `rule_operation` (String) Operation of the rule (e.g. OR,IN,EQ,LIKE,ILIKE,AND) | ||
- `rule_value` (String) Value of the parameter (e.g. for portName:1/0/1,for adminStatus,status:up/down, for speed: any integer value, for description: any valid string, for family:switches, for series:C3650, for managementIpAddress:10.197.124.90, groupNameHierarchy:Global, softwareVersion: 16.9.1) | ||
- `rule_values` (List of String) values of the parameter,Only one of the value or values can be used for the given parameter. (for managementIpAddress e.g. ["10.197.124.90","10.197.124.91"]) | ||
|
||
<a id="nestedatt--dynamic_rules--rule_items"></a> | ||
### Nested Schema for `dynamic_rules.rule_items` | ||
|
||
Read-Only: | ||
|
||
- `name` (String) Name of the parameter (e.g. managementIpAddress,hostname) | ||
- `operation` (String) Operation of the rule (e.g. OR,IN,EQ,LIKE,ILIKE,AND) | ||
- `value` (String) Value of the parameter (e.g. %10%,%NA%) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "catalystcenter_assign_templates_to_tag Resource - terraform-provider-catalystcenter" | ||
subcategory: "Tags" | ||
description: |- | ||
This resource is responsible for assigning templates to a specified tag during creation and removing the template from the tag during destroy operation. | ||
--- | ||
|
||
# catalystcenter_assign_templates_to_tag (Resource) | ||
|
||
This resource is responsible for assigning templates to a specified tag during creation and removing the template from the tag during destroy operation. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "catalystcenter_assign_templates_to_tag" "example" { | ||
tag_id = "ea505070-6bb8-493f-bff0-8058e8e03ee5" | ||
template_ids = ["75b0f85a-8157-4db3-ae2d-9807c893319a"] | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `tag_id` (String) Tag Id to be associated with the template | ||
|
||
### Optional | ||
|
||
- `template_ids` (Set of String) Template Ids List | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The id of the object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "catalystcenter_tag Resource - terraform-provider-catalystcenter" | ||
subcategory: "Tags" | ||
description: |- | ||
This resource can manage a Tag. | ||
--- | ||
|
||
# catalystcenter_tag (Resource) | ||
|
||
This resource can manage a Tag. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "catalystcenter_tag" "example" { | ||
name = "Tag1" | ||
description = "Tag1 Description" | ||
system_tag = false | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `name` (String) | ||
|
||
### Optional | ||
|
||
- `description` (String) Description of the tag | ||
- `dynamic_rules` (Attributes List) Dynamic rules details (see [below for nested schema](#nestedatt--dynamic_rules)) | ||
- `system_tag` (Boolean) true for system created tags, false for user defined tag | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The id of the object | ||
|
||
<a id="nestedatt--dynamic_rules"></a> | ||
### Nested Schema for `dynamic_rules` | ||
|
||
Optional: | ||
|
||
- `member_type` (String) memberType of the tag (e.g. networkdevice, interface) | ||
- `rule_items` (Attributes List) items details, multiple rules can be defined by items (see [below for nested schema](#nestedatt--dynamic_rules--rule_items)) | ||
- `rule_name` (String) Name of the parameter (e.g. for interface:portName,adminStatus,speed,status,description. for networkdevice:family,series,hostname,managementIpAddress,groupNameHierarchy,softwareVersion) | ||
- `rule_operation` (String) Operation of the rule (e.g. OR,IN,EQ,LIKE,ILIKE,AND) | ||
- `rule_value` (String) Value of the parameter (e.g. for portName:1/0/1,for adminStatus,status:up/down, for speed: any integer value, for description: any valid string, for family:switches, for series:C3650, for managementIpAddress:10.197.124.90, groupNameHierarchy:Global, softwareVersion: 16.9.1) | ||
- `rule_values` (List of String) values of the parameter,Only one of the value or values can be used for the given parameter. (for managementIpAddress e.g. ["10.197.124.90","10.197.124.91"]) | ||
|
||
<a id="nestedatt--dynamic_rules--rule_items"></a> | ||
### Nested Schema for `dynamic_rules.rule_items` | ||
|
||
Optional: | ||
|
||
- `name` (String) Name of the parameter (e.g. managementIpAddress,hostname) | ||
- `operation` (String) Operation of the rule (e.g. OR,IN,EQ,LIKE,ILIKE,AND) | ||
- `value` (String) Value of the parameter (e.g. %10%,%NA%) | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
terraform import catalystcenter_tag.example "<name>" | ||
``` |
3 changes: 3 additions & 0 deletions
3
examples/data-sources/catalystcenter_assign_templates_to_tag/data-source.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "catalystcenter_assign_templates_to_tag" "example" { | ||
tag_id = "ea505070-6bb8-493f-bff0-8058e8e03ee5" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
data "catalystcenter_tag" "example" { | ||
name = "Tag1" | ||
} |
4 changes: 4 additions & 0 deletions
4
examples/resources/catalystcenter_assign_templates_to_tag/resource.tf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource "catalystcenter_assign_templates_to_tag" "example" { | ||
tag_id = "ea505070-6bb8-493f-bff0-8058e8e03ee5" | ||
template_ids = ["75b0f85a-8157-4db3-ae2d-9807c893319a"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
terraform import catalystcenter_tag.example "<name>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
resource "catalystcenter_tag" "example" { | ||
name = "Tag1" | ||
description = "Tag1 Description" | ||
system_tag = false | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
name: Assign Templates to Tag | ||
rest_endpoint: /dna/intent/api/v1/tag/%v/member | ||
get_extra_query_params: '?memberType=template' | ||
get_no_id: true | ||
# Manual updates in Delete function to handle removal of templates from tag in resource file, and fromBody, updateFromBody functions in model file | ||
res_description: 'This resource is responsible for assigning templates to a specified tag during creation | ||
and removing the template from the tag during destroy operation.' | ||
post_update: true | ||
no_import: true | ||
data_source_no_id: true | ||
skip_minimum_test: true | ||
doc_category: Tags | ||
attributes: | ||
- model_name: tagId | ||
type: String | ||
reference: true | ||
id: true | ||
description: Tag Id to be associated with the template | ||
example: ea505070-6bb8-493f-bff0-8058e8e03ee5 | ||
test_value: catalystcenter_tag.test.id | ||
- model_name: template | ||
tf_name: template_ids | ||
type: Set | ||
element_type: String | ||
description: Template Ids List | ||
example: 75b0f85a-8157-4db3-ae2d-9807c893319a | ||
test_value: '[catalystcenter_template.test.id]' | ||
test_prerequisites: | | ||
resource "catalystcenter_tag" "test" { | ||
name = "Tag1" | ||
description = "Tag1 Description" | ||
system_tag = false | ||
} | ||
|
||
resource "catalystcenter_project" "test" { | ||
name = "Project1" | ||
} | ||
|
||
resource "catalystcenter_template" "test" { | ||
project_id = catalystcenter_project.test.id | ||
name = "Template1" | ||
description = "My description" | ||
device_types = [ | ||
{ | ||
product_family = "Switches and Hubs" | ||
product_series = "Cisco Catalyst 9300 Series Switches" | ||
product_type = "Cisco Catalyst 9300 Switch" | ||
} | ||
] | ||
language = "JINJA" | ||
software_type = "IOS-XE" | ||
software_variant = "XE" | ||
software_version = "16.12.1a" | ||
template_content = "hostname SW1" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
name: Tag | ||
rest_endpoint: /dna/intent/api/v1/tag | ||
id_from_query_path: response.0 | ||
id_from_query_path_attribute: id | ||
put_id_include_path: id | ||
import_no_id: true | ||
data_source_no_id: true | ||
doc_category: Tags | ||
attributes: | ||
- model_name: name | ||
response_data_path: response.0.name | ||
type: String | ||
mandatory: true | ||
query_param: true | ||
example: Tag1 | ||
- model_name: description | ||
response_data_path: response.0.description | ||
type: String | ||
description: Description of the tag | ||
example: Tag1 Description | ||
- model_name: systemTag | ||
response_data_path: response.0.systemTag | ||
type: Bool | ||
description: true for system created tags, false for user defined tag | ||
example: false | ||
- model_name: dynamicRules | ||
response_data_path: response.0.dynamicRules | ||
type: List | ||
description: Dynamic rules details | ||
exclude_test: true | ||
attributes: | ||
- model_name: memberType | ||
type: String | ||
description: memberType of the tag (e.g. networkdevice, interface) | ||
- model_name: values | ||
tf_name: rule_values | ||
danischm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_path: rules | ||
type: List | ||
element_type: String | ||
description: 'values of the parameter,Only one of the value or values can be used for the given parameter. (for managementIpAddress e.g. [\"10.197.124.90\",\"10.197.124.91\"])' | ||
- model_name: items | ||
tf_name: rule_items | ||
danischm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_path: rules | ||
type: List | ||
description: 'items details, multiple rules can be defined by items' | ||
attributes: | ||
- model_name: operation | ||
type: String | ||
danischm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description: Operation of the rule (e.g. OR,IN,EQ,LIKE,ILIKE,AND) | ||
- model_name: name | ||
type: String | ||
description: Name of the parameter (e.g. managementIpAddress,hostname) | ||
- model_name: value | ||
type: String | ||
description: Value of the parameter (e.g. %10%,%NA%) | ||
- model_name: operation | ||
tf_name: rule_operation | ||
danischm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_path: rules | ||
type: String | ||
danischm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
description: Operation of the rule (e.g. OR,IN,EQ,LIKE,ILIKE,AND) | ||
- model_name: name | ||
tf_name: rule_name | ||
danischm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_path: rules | ||
type: String | ||
description: 'Name of the parameter (e.g. for interface:portName,adminStatus,speed,status,description. for networkdevice:family,series,hostname,managementIpAddress,groupNameHierarchy,softwareVersion)' | ||
- model_name: value | ||
tf_name: rule_value | ||
danischm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_path: rules | ||
type: String | ||
description: 'Value of the parameter (e.g. for portName:1/0/1,for adminStatus,status:up/down, for speed: any integer value, for description: any valid string, for family:switches, for series:C3650, for managementIpAddress:10.197.124.90, groupNameHierarchy:Global, softwareVersion: 16.9.1)' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.