Skip to content

Commit

Permalink
Minor fixes and added deploy template definition (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba-mazurkiewicz authored Feb 20, 2024
1 parent 3bc677e commit db091e5
Show file tree
Hide file tree
Showing 21 changed files with 1,502 additions and 21 deletions.
7 changes: 5 additions & 2 deletions docs/resources/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ resource "catalystcenter_building" "example" {

### Required

- `name` (String) The name of the building
- `parent_name` (String) The path of the parent area, e.g. `Global/Area5`. `Global` in case of root area.

### Optional

- `address` (String) The address of the building
- `country` (String) The country of the building
- `latitude` (Number) Latitude
- `longitude` (Number) Longitude
- `name` (String) The name of the building
- `parent_name` (String) The path of the parent area, e.g. `Global/Area5`. `Global` in case of root area.

### Read-Only

Expand Down
102 changes: 102 additions & 0 deletions docs/resources/deploy_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "catalystcenter_deploy_template Resource - terraform-provider-catalystcenter"
subcategory: "Templates"
description: |-
This resource can manage a Deploy Template.
---

# catalystcenter_deploy_template (Resource)

This resource can manage a Deploy Template.

## Example Usage

```terraform
resource "catalystcenter_deploy_template" "example" {
template_id = "12345678-1234-1234-1234-123456789012"
force_push_template = false
is_composite = false
target_info = [
{
host_name = "SW01"
type = "MANAGED_DEVICE_HOSTNAME"
versioned_template_id = "12345678-1234-1234-1234-123456789012"
}
]
}
```

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

### Required

- `target_info` (Attributes List) Target info to deploy template (see [below for nested schema](#nestedatt--target_info))
- `template_id` (String) UUID of template to be provisioned

### Optional

- `force_push_template` (Boolean) Force Push Template
- `is_composite` (Boolean) Composite template flag
- `main_template_id` (String) Composite Template ID
- `member_template_deployment_info` (Attributes List) Member Template Deployment Info (see [below for nested schema](#nestedatt--member_template_deployment_info))

### Read-Only

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

<a id="nestedatt--target_info"></a>
### Nested Schema for `target_info`

Required:

- `type` (String) Target type of device
- Choices: `MANAGED_DEVICE_IP`, `MANAGED_DEVICE_UUID`, `PRE_PROVISIONED_SERIAL`, `PRE_PROVISIONED_MAC`, `DEFAULT`, `MANAGED_DEVICE_HOSTNAME`
- `versioned_template_id` (String) Versioned templateUUID to be provisioned

Optional:

- `host_name` (String) Hostname of device is required if targetType is MANAGED_DEVICE_HOSTNAME
- `id` (String) UUID of target is required if targetType is MANAGED_DEVICE_UUID
- `params` (Map of String) Template params/values to be provisioned
- `resource_params` (Map of String) Resource params to be provisioned


<a id="nestedatt--member_template_deployment_info"></a>
### Nested Schema for `member_template_deployment_info`

Required:

- `target_info` (Attributes List) Target info to deploy template (see [below for nested schema](#nestedatt--member_template_deployment_info--target_info))
- `template_id` (String) UUID of template to be provisioned

Optional:

- `force_push_template` (Boolean) Force Push Template
- `is_composite` (Boolean) Composite template flag
- `main_template_id` (String) Composite Template ID

<a id="nestedatt--member_template_deployment_info--target_info"></a>
### Nested Schema for `member_template_deployment_info.target_info`

Required:

- `type` (String) Target type of device
- Choices: `MANAGED_DEVICE_IP`, `MANAGED_DEVICE_UUID`, `PRE_PROVISIONED_SERIAL`, `PRE_PROVISIONED_MAC`, `DEFAULT`, `MANAGED_DEVICE_HOSTNAME`
- `versioned_template_id` (String) Versioned templateUUID to be provisioned

Optional:

- `host_name` (String) Hostname of device is required if targetType is MANAGED_DEVICE_HOSTNAME
- `id` (String) UUID of target is required if targetType is MANAGED_DEVICE_UUID
- `params` (Map of String) Template params/values to be provisioned
- `resource_params` (Map of String) Resource params to be provisioned

## Import

Import is supported using the following syntax:

```shell
terraform import catalystcenter_deploy_template.example "12345678-1234-1234-1234-123456789012"
```
4 changes: 2 additions & 2 deletions docs/resources/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ Required:

- `data_type` (String) Datatype of template parameter
- Choices: `STRING`, `INTEGER`, `IPADDRESS`, `MACADDRESS`, `SECTIONDIVIDER`
- `selection_type` (String) Type of selection
- Choices: `SINGLE_SELECT`, `MULTI_SELECT`

Optional:

Expand All @@ -107,6 +105,8 @@ Optional:
- `parameter_name` (String) Name of the template parameter
- `ranges` (Attributes List) List of ranges (see [below for nested schema](#nestedatt--template_params--ranges))
- `required` (Boolean) Is parameter required
- `selection_type` (String) Type of selection
- Choices: `SINGLE_SELECT`, `MULTI_SELECT`
- `selection_values` (Map of String) Selection values

<a id="nestedatt--template_params--ranges"></a>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "catalystcenter_deploy_template" "example" {
id = "12345678-1234-1234-1234-123456789012"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import catalystcenter_deploy_template.example "12345678-1234-1234-1234-123456789012"
12 changes: 12 additions & 0 deletions examples/resources/catalystcenter_deploy_template/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "catalystcenter_deploy_template" "example" {
template_id = "12345678-1234-1234-1234-123456789012"
force_push_template = false
is_composite = false
target_info = [
{
host_name = "SW01"
type = "MANAGED_DEVICE_HOSTNAME"
versioned_template_id = "12345678-1234-1234-1234-123456789012"
}
]
}
4 changes: 0 additions & 4 deletions gen/definitions/building.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,23 @@ attributes:
data_path: site.building
response_data_path: response.0.additionalInfo.0.attributes.country
type: String
mandatory: true
description: The country of the building
example: United States
- model_name: address
data_path: site.building
response_data_path: response.0.additionalInfo.0.attributes.address
type: String
mandatory: true
description: The address of the building
example: 150 W Tasman Dr, San Jose
- model_name: latitude
data_path: site.building
response_data_path: response.0.additionalInfo.0.attributes.latitude
type: Float64
mandatory: true
description: Latitude
example: 37.338
- model_name: longitude
data_path: site.building
response_data_path: response.0.additionalInfo.0.attributes.longitude
type: Float64
mandatory: true
description: Longitude
example: -121.832
146 changes: 146 additions & 0 deletions gen/definitions/deploy_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
name: Deploy Template
rest_endpoint: /dna/intent/api/v2/template-programmer/template/deploy
no_delete: true
no_update: true
no_read: true
no_import: true
no_data_source: true
skip_minimum_test: true
doc_category: Templates
test_tags: [TEMPLATES]
attributes:
- model_name: templateId
type: String
id: true
description: ID of template to be provisioned
test_value: catalystcenter_template_version.example.id
example: 12345678-1234-1234-1234-123456789012
- model_name: forcePushTemplate
type: Bool
description: Force Push Template
example: false
- model_name: isComposite
type: Bool
description: Composite template flag
example: false
- model_name: mainTemplateId
type: String
description: Composite Template ID
exclude_test: true
- model_name: memberTemplateDeploymentInfo
type: List
description: Member Template Deployment Info
exclude_test: true
attributes:
- model_name: templateId
type: String
id: true
description: ID of template to be provisioned
- model_name: forcePushTemplate
type: Bool
description: Force Push Template
- model_name: isComposite
type: Bool
description: Composite template flag
- model_name: mainTemplateId
type: String
description: Composite Template ID
- model_name: targetInfo
type: List
mandatory: true
description: Target info to deploy template
attributes:
- model_name: hostName
type: String
description: Hostname of device is required if targetType is MANAGED_DEVICE_HOSTNAME
- model_name: id
type: String
description: UUID of target is required if targetType is MANAGED_DEVICE_UUID
- model_name: params
type: Map
description: Template params/values to be provisioned
- model_name: resourceParams
type: Map
description: Resource params to be provisioned
- model_name: type
type: String
enum_values:
- MANAGED_DEVICE_IP
- MANAGED_DEVICE_UUID
- PRE_PROVISIONED_SERIAL
- PRE_PROVISIONED_MAC
- DEFAULT
- MANAGED_DEVICE_HOSTNAME
mandatory: true
description: Target type of device
- model_name: versionedTemplateId
type: String
mandatory: true
description: Versioned template ID to be provisioned
- model_name: targetInfo
type: List
mandatory: true
description: Target info to deploy template
attributes:
- model_name: hostName
type: String
description: Hostname of device is required if targetType is MANAGED_DEVICE_HOSTNAME
example: SW01
- model_name: id
type: String
description: ID of device is required if `type` is MANAGED_DEVICE_UUID
exclude_test: true
- model_name: params
type: Map
description: Template params/values to be provisioned
exclude_test: true
- model_name: resourceParams
type: Map
description: Resource params to be provisioned
exclude_test: true
- model_name: type
type: String
enum_values:
- MANAGED_DEVICE_IP
- MANAGED_DEVICE_UUID
- PRE_PROVISIONED_SERIAL
- PRE_PROVISIONED_MAC
- DEFAULT
- MANAGED_DEVICE_HOSTNAME
mandatory: true
description: Target type of device
example: MANAGED_DEVICE_HOSTNAME
- model_name: versionedTemplateId
type: String
mandatory: true
description: Versioned template ID to be provisioned
example: 12345678-1234-1234-1234-123456789012
test_value: catalystcenter_template_version.example.id
test_prerequisites: |
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"
}
resource "catalystcenter_template_version" "example" {
template_id = catalystcenter_template.test.id
comments = "New Version"
}
2 changes: 1 addition & 1 deletion gen/definitions/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ put_id_include_path: id
put_no_id: true
id_path: response.data
id_from_query_path_attribute: templateId
get_extra_query_params: "?unCommitted=true"
doc_category: Templates
attributes:
- model_name: project_id
Expand Down Expand Up @@ -147,7 +148,6 @@ attributes:
enum_values:
- SINGLE_SELECT
- MULTI_SELECT
mandatory: true
description: Type of selection
example: SINGLE_SELECT
- model_name: selectionValues
Expand Down
3 changes: 2 additions & 1 deletion gen/templates/data_source.go

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

Loading

0 comments on commit db091e5

Please sign in to comment.