Skip to content

Commit

Permalink
Fixes url list issue (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
seconroy authored Sep 12, 2024
1 parent e7a1229 commit 4176130
Show file tree
Hide file tree
Showing 30 changed files with 1,765 additions and 18 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
- Add `sdwan_policy_object_security_local_domain_list` resource and data source
- Add `sdwan_policy_object_security_port_list` resource and data source
- Add `sdwan_policy_object_security_scalable_group_tag_list` resource and data source
- Add `sdwan_policy_object_security_url_list` resource and data source
- Add `sdwan_policy_object_security_url_allow_list` resource and data source
- Add `sdwan_policy_object_security_url_block_list` resource and data source
- Add `sdwan_policy_object_preferred_color_group` resource and data source
- Add `sdwan_policy_object_security_identity_list` resource and data source
- Add `sdwan_policy_object_security_local_application_list` resource and data source
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "sdwan_policy_object_security_url_list Data Source - terraform-provider-sdwan"
page_title: "sdwan_policy_object_security_url_allow_list Data Source - terraform-provider-sdwan"
subcategory: "Policy Objects"
description: |-
This data source can read the Policy Object Security URL List Policy_object.
This data source can read the Policy Object Security URL Allow List Policy_object.
---

# sdwan_policy_object_security_url_list (Data Source)
# sdwan_policy_object_security_url_allow_list (Data Source)

This data source can read the Policy Object Security URL List Policy_object.
This data source can read the Policy Object Security URL Allow List Policy_object.

## Example Usage

```terraform
data "sdwan_policy_object_security_url_list" "example" {
data "sdwan_policy_object_security_url_allow_list" "example" {
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
}
Expand Down
42 changes: 42 additions & 0 deletions docs/data-sources/policy_object_security_url_block_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "sdwan_policy_object_security_url_block_list Data Source - terraform-provider-sdwan"
subcategory: "Policy Objects"
description: |-
This data source can read the Policy Object Security URL Block List Policy_object.
---

# sdwan_policy_object_security_url_block_list (Data Source)

This data source can read the Policy Object Security URL Block List Policy_object.

## Example Usage

```terraform
data "sdwan_policy_object_security_url_block_list" "example" {
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
}
```

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

### Required

- `feature_profile_id` (String) Feature Profile ID
- `id` (String) The id of the Policy_object

### Read-Only

- `description` (String) The description of the Policy_object
- `entries` (Attributes List) URL List (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:

- `pattern` (String) valid url pattern
3 changes: 2 additions & 1 deletion docs/guides/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ description: |-
- Add `sdwan_policy_object_security_local_domain_list` resource and data source
- Add `sdwan_policy_object_security_port_list` resource and data source
- Add `sdwan_policy_object_security_scalable_group_tag_list` resource and data source
- Add `sdwan_policy_object_security_url_list` resource and data source
- Add `sdwan_policy_object_security_url_allow_list` resource and data source
- Add `sdwan_policy_object_security_url_block_list` resource and data source
- Add `sdwan_policy_object_preferred_color_group` resource and data source
- Add `sdwan_policy_object_security_identity_list` resource and data source
- Add `sdwan_policy_object_security_local_application_list` resource and data source
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "sdwan_policy_object_security_url_list Resource - terraform-provider-sdwan"
page_title: "sdwan_policy_object_security_url_allow_list Resource - terraform-provider-sdwan"
subcategory: "Policy Objects"
description: |-
This resource can manage a Policy Object Security URL List Policy_object.
This resource can manage a Policy Object Security URL Allow List Policy_object.
Minimum SD-WAN Manager version: 20.12.0
---

# sdwan_policy_object_security_url_list (Resource)
# sdwan_policy_object_security_url_allow_list (Resource)

This resource can manage a Policy Object Security URL List Policy_object.
This resource can manage a Policy Object Security URL Allow List Policy_object.
- Minimum SD-WAN Manager version: `20.12.0`

## Example Usage

```terraform
resource "sdwan_policy_object_security_url_list" "example" {
resource "sdwan_policy_object_security_url_allow_list" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
Expand Down Expand Up @@ -57,5 +57,5 @@ Optional:
Import is supported using the following syntax:

```shell
terraform import sdwan_policy_object_security_url_list.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
terraform import sdwan_policy_object_security_url_allow_list.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
```
61 changes: 61 additions & 0 deletions docs/resources/policy_object_security_url_block_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "sdwan_policy_object_security_url_block_list Resource - terraform-provider-sdwan"
subcategory: "Policy Objects"
description: |-
This resource can manage a Policy Object Security URL Block List Policy_object.
Minimum SD-WAN Manager version: 20.12.0
---

# sdwan_policy_object_security_url_block_list (Resource)

This resource can manage a Policy Object Security URL Block List Policy_object.
- Minimum SD-WAN Manager version: `20.12.0`

## Example Usage

```terraform
resource "sdwan_policy_object_security_url_block_list" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
entries = [
{
pattern = "www.cisco.com"
}
]
}
```

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

### Required

- `entries` (Attributes List) URL List (see [below for nested schema](#nestedatt--entries))
- `feature_profile_id` (String) Feature Profile ID
- `name` (String) The name of the Policy_object

### Optional

- `description` (String) The description of the Policy_object

### Read-Only

- `id` (String) The id of the Policy_object
- `version` (Number) The version of the Policy_object

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

Optional:

- `pattern` (String) valid url pattern

## Import

Import is supported using the following syntax:

```shell
terraform import sdwan_policy_object_security_url_block_list.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "sdwan_policy_object_security_url_allow_list" "example" {
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "sdwan_policy_object_security_url_block_list" "example" {
id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import sdwan_policy_object_security_url_allow_list.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "sdwan_policy_object_security_url_allow_list" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
entries = [
{
pattern = "www.cisco.com"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import sdwan_policy_object_security_url_block_list.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "sdwan_policy_object_security_url_block_list" "example" {
name = "Example"
description = "My Example"
feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
entries = [
{
pattern = "www.cisco.com"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
name: Policy Object Security URL List
name: Policy Object Security URL Allow List
rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/security-urllist
minimum_version: 20.12.0
test_tags: [SDWAN_2012]
skip_minimum_test: true
parcel_type: policy_object
type_value: urlallowed
attributes:
- tf_name: feature_profile_id
reference: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Policy Object Security URL Block List
rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/security-urllist
minimum_version: 20.12.0
test_tags: [SDWAN_2012]
skip_minimum_test: true
parcel_type: policy_object
type_value: urlblocked
attributes:
- tf_name: feature_profile_id
reference: true
type: String
mandatory: true
description: Feature Profile ID
example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
test_value: sdwan_policy_object_feature_profile.test.id
- model_name: entries
mandatory: true
attributes:
- model_name: pattern
id: true
mandatory: true
example: www.cisco.com

test_prerequisites: |
resource "sdwan_policy_object_feature_profile" "test" {
name = "POLICY_OBJECT_FP_1"
description = "My policy object feature profile 1"
}
114 changes: 114 additions & 0 deletions gen/models/profile_parcels/policy_object_security_url_block_list.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
{
"request": {
"$schema": "http://json-schema.org/draft/2019-09/schema",
"$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-urllist/post/request_schema.json",
"title": "URL List Parcel Schema",
"description": "URL List profile parcel schema for POST request",
"type": "object",
"properties": {
"name": {
"type": "string",
"pattern": "^[^&<>! \"]+$",
"minLength": 1,
"maxLength": 32
},
"description": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"urlallowed",
"urlblocked"
]
},
"data": {
"type": "object",
"properties": {
"entries": {
"description": "URL List",
"type": "array",
"maxItems": 64,
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "object",
"properties": {
"pattern": {
"description": "valid url pattern",
"type": "object",
"properties": {
"optionType": {
"type": "string",
"enum": [
"global"
]
},
"value": {
"type": "string",
"minLength": 1,
"maxLength": 240,
"pattern": "^[^*+].*"
}
},
"required": [
"optionType",
"value"
],
"additionalProperties": false
}
},
"required": [
"pattern"
],
"additionalProperties": false
}
}
},
"required": [
"entries"
],
"additionalProperties": false
},
"documentation": {
"description": "This is the documentation for POST request schema for URL List profile parcel",
"details-1": "variable name should be present with given format as specified in schema if optionType value is variable",
"details-2": "variable name should not be present if optionType value is NOT variable",
"details-3": "when option Type is global, value should be present with given format/restrictions as specified in schema",
"details-4": "when option Type is default, value should be present with given default value as specified in schema",
"examples": [
{
"data": {
"entries": [
{
"pattern": {
"optionType": "global",
"value": "www.google.com"
}
},
{
"pattern": {
"optionType": "global",
"value": "outlook.com"
}
}
]
},
"name": "UrlList"
}
]
}
},
"required": [
"name",
"data",
"type"
],
"not": {
"required": [
"documentation"
]
},
"additionalProperties": false
}
}
2 changes: 1 addition & 1 deletion gen/schema/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ attributes: list(include('attribute'), required=False) # List of attributes
test_tags: list(str(), required=False) # List of test tags, tests are only executed if an environment variable with one of these tags is configured
test_prerequisites: str(required=False) # HCL code that is included in the acceptance tests to define prerequisites
remove_id: bool(required=False) # Set to true if default ID attribute should be removed
type_value: str(required=False) # Set to a string which is being provided as a read-only "type" resource and data source attribute
type_value: str(required=False) # Set to a string which is being provided as a read-only "type" resource and data source attribute (Generic) or add to the body of a request (Profile parcels)
no_import: bool(required=False) # Set to true if the resource does not support importing
no_data_source: bool(required=False) # Set to true if no data source should be created
no_resource: bool(required=False) # Set to true if no resource should be created
Expand Down
3 changes: 3 additions & 0 deletions gen/templates/profile_parcels/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context) string {
body := ""
body, _ = sjson.Set(body, "name", data.Name.ValueString())
body, _ = sjson.Set(body, "description", data.Description.ValueString())
{{- if .TypeValue}}
body, _ = sjson.Set(body, "type", "{{.TypeValue}}")
{{- end}}
path := "data."
{{- range .Attributes}}
{{- if .Value}}
Expand Down
Loading

0 comments on commit 4176130

Please sign in to comment.