Skip to content

Commit

Permalink
Refactor class map policy object resource and data source
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Jul 24, 2023
1 parent 666c076 commit d1a2f65
Show file tree
Hide file tree
Showing 14 changed files with 121 additions and 162 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- Add `set_parameters` to `sdwan_acl_policy_definition` resource and data source
- BREAKING CHANGE: Remove `dscp` and `next_hop` attributes of `sdwan_acl_policy_definition` resource and data source
- BREAKING CHANGE: Rename `layer2cos` attribute of `sdwan_rewrite_rule_policy_definition` resource and data source to `layer2_cos`
- BREAKING CHANGE: Remove `entries` attribute of `sdwan_class_map_policy_object` resource and data source

## 0.2.1

Expand Down
15 changes: 4 additions & 11 deletions docs/data-sources/class_map_policy_object.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "sdwan_class_map_policy_object Data Source - terraform-provider-sdwan"
subcategory: "Policy Objects"
description: |-
This data source can read the Class Map policy object.
This data source can read the Class Map Policy Object .
---

# sdwan_class_map_policy_object (Data Source)

This data source can read the Class Map policy object.
This data source can read the Class Map Policy Object .

## Example Usage

Expand All @@ -23,17 +23,10 @@ data "sdwan_class_map_policy_object" "example" {

### Required

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

### Read-Only

- `entries` (Attributes List) List of entries, only 1 entry supported (see [below for nested schema](#nestedatt--entries))
- `name` (String) The name of the policy object
- `version` (Number) The version of the policy object

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

Read-Only:

- `queue` (Number) Queue
- `version` (Number) The version of the object
1 change: 1 addition & 0 deletions docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ description: |-
- Add `set_parameters` to `sdwan_acl_policy_definition` resource and data source
- BREAKING CHANGE: Remove `dscp` and `next_hop` attributes of `sdwan_acl_policy_definition` resource and data source
- BREAKING CHANGE: Rename `layer2cos` attribute of `sdwan_rewrite_rule_policy_definition` resource and data source to `layer2_cos`
- BREAKING CHANGE: Remove `entries` attribute of `sdwan_class_map_policy_object` resource and data source

## 0.2.1

Expand Down
27 changes: 8 additions & 19 deletions docs/resources/class_map_policy_object.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@
page_title: "sdwan_class_map_policy_object Resource - terraform-provider-sdwan"
subcategory: "Policy Objects"
description: |-
This resource can manage a Class Map policy object.
This resource can manage a Class Map Policy Object .
---

# sdwan_class_map_policy_object (Resource)

This resource can manage a Class Map policy object.
This resource can manage a Class Map Policy Object .

## Example Usage

```terraform
resource "sdwan_class_map_policy_object" "example" {
name = "Example"
entries = [
{
queue = 2
}
]
name = "Example"
queue = 2
}
```

Expand All @@ -28,21 +24,14 @@ resource "sdwan_class_map_policy_object" "example" {

### Required

- `entries` (Attributes List) List of entries, only 1 entry supported (see [below for nested schema](#nestedatt--entries))
- `name` (String) The name of the policy object
- `queue` (Number) Queue
- Range: `0`-`7`

### Read-Only

- `id` (String) The id of the policy object
- `version` (Number) The version of the feature template

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

Required:

- `queue` (Number) Queue
- Range: `0`-`7`
- `id` (String) The id of the object
- `version` (Number) The version of the object

## Import

Expand Down
8 changes: 2 additions & 6 deletions examples/resources/sdwan_class_map_policy_object/resource.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
resource "sdwan_class_map_policy_object" "example" {
name = "Example"
entries = [
{
queue = 2
}
]
name = "Example"
queue = 2
}
24 changes: 24 additions & 0 deletions gen/definitions/generic/class_map_policy_object.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Class Map Policy Object
rest_endpoint: /template/policy/list/class/
has_version: true
id_attribute: listId
doc_category: Policy Objects
attributes:
- model_name: type
value: class
- model_name: name
tf_name: name
type: String
mandatory: true
description: The name of the policy object
example: Example
- model_name: queue
data_path: [entries.0]
type: Int64
mandatory: true
model_type_string: true
description: Queue
min_int: 0
max_int: 7
example: 2
19 changes: 0 additions & 19 deletions gen/definitions/policy_objects/class_map.yaml

This file was deleted.

20 changes: 6 additions & 14 deletions internal/provider/data_source_sdwan_class_map_policy_object.go

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

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

67 changes: 29 additions & 38 deletions internal/provider/model_sdwan_class_map_policy_object.go

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

4 changes: 2 additions & 2 deletions internal/provider/provider.go

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

Loading

0 comments on commit d1a2f65

Please sign in to comment.