diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6eeb98c5..3df9463f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,18 @@
- BREAKING CHANGE: Rename `aaa_derive_name_identity` attribute of `sdwan_system_remote_access_profile_parcel` resource to `aaa_derive_name_from_peer_identity`
- BREAKING CHANGE: Rename `aaa_derive_name_domain` attribute of `sdwan_system_remote_access_profile_parcel` resource to `aaa_derive_name_from_peer_domain`
- BREAKING CHANGE: Removes `any_connect_eap_profile_download_status` and `any_connect_eap_profile_file_name` attributes of `sdwan_system_remote_access_profile_parcel
+- Add `sdwan_policy_object_feature_profile` resource and data source
+- Add `sdwan_policy_object_class_map_profile_parcel` resource and data source
+- Add `sdwan_policy_object_color_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_data_ipv6_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_data_ipv4_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_tloc_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_expanded_community_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_extended_community_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_mirror_profile_parcel` resource and data source
+- Add `sdwan_policy_object_policer_profile_parcel` resource and data source
+- Add `sdwan_policy_object_ipv4_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_ipv6_prefix_list_profile_parcel` resource and data source
## 0.3.13
diff --git a/docs/data-sources/policy_object_class_map_profile_parcel.md b/docs/data-sources/policy_object_class_map_profile_parcel.md
new file mode 100644
index 00000000..d3ee1701
--- /dev/null
+++ b/docs/data-sources/policy_object_class_map_profile_parcel.md
@@ -0,0 +1,42 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_class_map_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Class Map profile parcel.
+---
+
+# sdwan_policy_object_class_map_profile_parcel (Data Source)
+
+This data source can read the Policy Object Class Map profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_class_map_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) class map List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `queue` (String) select a queue
diff --git a/docs/data-sources/policy_object_color_list_profile_parcel.md b/docs/data-sources/policy_object_color_list_profile_parcel.md
new file mode 100644
index 00000000..4686d0ae
--- /dev/null
+++ b/docs/data-sources/policy_object_color_list_profile_parcel.md
@@ -0,0 +1,42 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_color_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Color List profile parcel.
+---
+
+# sdwan_policy_object_color_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object Color List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_color_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) Color List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `color` (String)
diff --git a/docs/data-sources/policy_object_data_ipv4_prefix_list_profile_parcel.md b/docs/data-sources/policy_object_data_ipv4_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..5d065c5a
--- /dev/null
+++ b/docs/data-sources/policy_object_data_ipv4_prefix_list_profile_parcel.md
@@ -0,0 +1,43 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Data IPv4 Prefix List profile parcel.
+---
+
+# sdwan_policy_object_data_ipv4_prefix_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object Data IPv4 Prefix List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) IPv4 Data Prefix List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `ipv4_address` (String) IPv4 address
+- `ipv4_prefix_length` (Number) IPv4 prefix Length
diff --git a/docs/data-sources/policy_object_data_ipv6_prefix_list_profile_parcel.md b/docs/data-sources/policy_object_data_ipv6_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..9e78716d
--- /dev/null
+++ b/docs/data-sources/policy_object_data_ipv6_prefix_list_profile_parcel.md
@@ -0,0 +1,43 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Data IPv6 Prefix List profile parcel.
+---
+
+# sdwan_policy_object_data_ipv6_prefix_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object Data IPv6 Prefix List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) IPv6 Prefix List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `ipv6_address` (String) IPv6 address
+- `ipv6_prefix_length` (Number) IPv6 prefix
diff --git a/docs/data-sources/policy_object_expanded_community_list_profile_parcel.md b/docs/data-sources/policy_object_expanded_community_list_profile_parcel.md
new file mode 100644
index 00000000..f8076889
--- /dev/null
+++ b/docs/data-sources/policy_object_expanded_community_list_profile_parcel.md
@@ -0,0 +1,36 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_expanded_community_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Expanded Community List profile parcel.
+---
+
+# sdwan_policy_object_expanded_community_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object Expanded Community List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_expanded_community_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `expanded_community_lists` (Set of String) Expanded Community List
+- `expanded_community_lists_variable` (String) Variable name
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
diff --git a/docs/data-sources/policy_object_extended_community_list_profile_parcel.md b/docs/data-sources/policy_object_extended_community_list_profile_parcel.md
new file mode 100644
index 00000000..acfb55de
--- /dev/null
+++ b/docs/data-sources/policy_object_extended_community_list_profile_parcel.md
@@ -0,0 +1,42 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_extended_community_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Extended Community List profile parcel.
+---
+
+# sdwan_policy_object_extended_community_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object Extended Community List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_extended_community_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) Extended Community List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `extended_community` (String) can be soo 10.0.0.1:30 or rt 500:50 etc.
diff --git a/docs/data-sources/policy_object_feature_profile.md b/docs/data-sources/policy_object_feature_profile.md
new file mode 100644
index 00000000..12a6b1e5
--- /dev/null
+++ b/docs/data-sources/policy_object_feature_profile.md
@@ -0,0 +1,31 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_feature_profile Data Source - terraform-provider-sdwan"
+subcategory: "Feature Profiles"
+description: |-
+ This data source can read the Policy Object Feature Profile .
+---
+
+# sdwan_policy_object_feature_profile (Data Source)
+
+This data source can read the Policy Object Feature Profile .
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_feature_profile" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `id` (String) The id of the object
+
+### Read-Only
+
+- `description` (String) Description
+- `name` (String) The name of the policy object feature profile
diff --git a/docs/data-sources/policy_object_ipv4_prefix_list_profile_parcel.md b/docs/data-sources/policy_object_ipv4_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..9664bb51
--- /dev/null
+++ b/docs/data-sources/policy_object_ipv4_prefix_list_profile_parcel.md
@@ -0,0 +1,45 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_ipv4_prefix_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object IPv4 Prefix List profile parcel.
+---
+
+# sdwan_policy_object_ipv4_prefix_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object IPv4 Prefix List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) IPv4 Prefix List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `ge` (Number) IPv4 prefix length with ge range operator
+- `ipv4_address` (String) IPv4 address
+- `ipv4_prefix_length` (Number) IPv4 prefix length
+- `le` (Number) IPv4 prefix length with le range operator
diff --git a/docs/data-sources/policy_object_ipv6_prefix_list_profile_parcel.md b/docs/data-sources/policy_object_ipv6_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..faa16c98
--- /dev/null
+++ b/docs/data-sources/policy_object_ipv6_prefix_list_profile_parcel.md
@@ -0,0 +1,45 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_ipv6_prefix_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object IPv6 Prefix List profile parcel.
+---
+
+# sdwan_policy_object_ipv6_prefix_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object IPv6 Prefix List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) IPv6 Prefix List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `ge` (Number) IPv6 prefix length with ge range operator
+- `ipv6_address` (String) IPv6 address
+- `ipv6_prefix_length` (Number) IPv6 prefix length
+- `le` (Number) IPv6 prefix length with le range operator
diff --git a/docs/data-sources/policy_object_mirror_profile_parcel.md b/docs/data-sources/policy_object_mirror_profile_parcel.md
new file mode 100644
index 00000000..b8fe6d14
--- /dev/null
+++ b/docs/data-sources/policy_object_mirror_profile_parcel.md
@@ -0,0 +1,43 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_mirror_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Mirror profile parcel.
+---
+
+# sdwan_policy_object_mirror_profile_parcel (Data Source)
+
+This data source can read the Policy Object Mirror profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_mirror_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) Mirror List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `remote_destination_ip` (String) remote destination ip address
+- `source_ip` (String) source ip address
diff --git a/docs/data-sources/policy_object_policer_profile_parcel.md b/docs/data-sources/policy_object_policer_profile_parcel.md
new file mode 100644
index 00000000..e1cbe08e
--- /dev/null
+++ b/docs/data-sources/policy_object_policer_profile_parcel.md
@@ -0,0 +1,44 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_policer_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object Policer profile parcel.
+---
+
+# sdwan_policy_object_policer_profile_parcel (Data Source)
+
+This data source can read the Policy Object Policer profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_policer_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) Policer Entries (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `burst_bytes` (Number) Burst (Bytes)
+- `exceed_action` (String) Exceed options such as Drop or Remark
+- `rate_bps` (Number) Rate (bps)
diff --git a/docs/data-sources/policy_object_tloc_list_profile_parcel.md b/docs/data-sources/policy_object_tloc_list_profile_parcel.md
new file mode 100644
index 00000000..342a27c0
--- /dev/null
+++ b/docs/data-sources/policy_object_tloc_list_profile_parcel.md
@@ -0,0 +1,45 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_tloc_list_profile_parcel Data Source - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This data source can read the Policy Object TLOC List profile parcel.
+---
+
+# sdwan_policy_object_tloc_list_profile_parcel (Data Source)
+
+This data source can read the Policy Object TLOC List profile parcel.
+
+## Example Usage
+
+```terraform
+data "sdwan_policy_object_tloc_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `feature_profile_id` (String) Feature Profile ID
+- `id` (String) The id of the profile parcel
+
+### Read-Only
+
+- `description` (String) The description of the profile parcel
+- `entries` (Attributes List) TLOC List (see [below for nested schema](#nestedatt--entries))
+- `name` (String) The name of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Read-Only:
+
+- `color` (String) color
+- `encapsulation` (String) encapsulation
+- `preference` (String) Preference
+- `tloc_ip` (String) tloc
diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md
index 9fc4e20f..18fd3f3b 100644
--- a/docs/guides/changelog.md
+++ b/docs/guides/changelog.md
@@ -21,6 +21,18 @@ description: |-
- BREAKING CHANGE: Rename `aaa_derive_name_identity` attribute of `sdwan_system_remote_access_profile_parcel` resource to `aaa_derive_name_from_peer_identity`
- BREAKING CHANGE: Rename `aaa_derive_name_domain` attribute of `sdwan_system_remote_access_profile_parcel` resource to `aaa_derive_name_from_peer_domain`
- BREAKING CHANGE: Removes `any_connect_eap_profile_download_status` and `any_connect_eap_profile_file_name` attributes of `sdwan_system_remote_access_profile_parcel
+- Add `sdwan_policy_object_feature_profile` resource and data source
+- Add `sdwan_policy_object_class_map_profile_parcel` resource and data source
+- Add `sdwan_policy_object_color_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_data_ipv6_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_data_ipv4_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_tloc_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_expanded_community_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_extended_community_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_mirror_profile_parcel` resource and data source
+- Add `sdwan_policy_object_policer_profile_parcel` resource and data source
+- Add `sdwan_policy_object_ipv4_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_ipv6_prefix_list_profile_parcel` resource and data source
## 0.3.13
diff --git a/docs/resources/policy_object_class_map_profile_parcel.md b/docs/resources/policy_object_class_map_profile_parcel.md
new file mode 100644
index 00000000..36e74435
--- /dev/null
+++ b/docs/resources/policy_object_class_map_profile_parcel.md
@@ -0,0 +1,62 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_class_map_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Class Map profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_class_map_profile_parcel (Resource)
+
+This resource can manage a Policy Object Class Map profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_class_map_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ queue = "0"
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) class map List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `queue` (String) select a queue
+ - Choices: `0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_class_map_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_color_list_profile_parcel.md b/docs/resources/policy_object_color_list_profile_parcel.md
new file mode 100644
index 00000000..76c71f96
--- /dev/null
+++ b/docs/resources/policy_object_color_list_profile_parcel.md
@@ -0,0 +1,61 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_color_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Color List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_color_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object Color List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_color_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ color = "blue"
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) Color List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `color` (String) - Choices: `3g`, `biz-internet`, `blue`, `bronze`, `custom1`, `custom2`, `custom3`, `default`, `gold`, `green`, `lte`, `metro-ethernet`, `mpls`, `private1`, `private2`, `private3`, `private4`, `private5`, `private6`, `public-internet`, `red`, `silver`
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_color_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_data_ipv4_prefix_list_profile_parcel.md b/docs/resources/policy_object_data_ipv4_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..cc00d579
--- /dev/null
+++ b/docs/resources/policy_object_data_ipv4_prefix_list_profile_parcel.md
@@ -0,0 +1,64 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Data IPv4 Prefix List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_data_ipv4_prefix_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object Data IPv4 Prefix List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv4_address = "10.0.0.0"
+ ipv4_prefix_length = 8
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) IPv4 Data Prefix List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `ipv4_address` (String) IPv4 address
+- `ipv4_prefix_length` (Number) IPv4 prefix Length
+ - Range: `0`-`32`
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_data_ipv6_prefix_list_profile_parcel.md b/docs/resources/policy_object_data_ipv6_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..d87ed08b
--- /dev/null
+++ b/docs/resources/policy_object_data_ipv6_prefix_list_profile_parcel.md
@@ -0,0 +1,64 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Data IPv6 Prefix List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_data_ipv6_prefix_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object Data IPv6 Prefix List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv6_address = "2001:db8:85a3::8a2e:370:7334"
+ ipv6_prefix_length = 64
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) IPv6 Prefix List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `ipv6_address` (String) IPv6 address
+- `ipv6_prefix_length` (Number) IPv6 prefix
+ - Range: `0`-`128`
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_expanded_community_list_profile_parcel.md b/docs/resources/policy_object_expanded_community_list_profile_parcel.md
new file mode 100644
index 00000000..ac5053b4
--- /dev/null
+++ b/docs/resources/policy_object_expanded_community_list_profile_parcel.md
@@ -0,0 +1,51 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_expanded_community_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Expanded Community List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_expanded_community_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object Expanded Community List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_expanded_community_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ expanded_community_lists = ["abcd"]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `expanded_community_lists` (Set of String) Expanded Community List
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+- `expanded_community_lists_variable` (String) Variable name
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_expanded_community_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_extended_community_list_profile_parcel.md b/docs/resources/policy_object_extended_community_list_profile_parcel.md
new file mode 100644
index 00000000..5e74ea1e
--- /dev/null
+++ b/docs/resources/policy_object_extended_community_list_profile_parcel.md
@@ -0,0 +1,61 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_extended_community_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Extended Community List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_extended_community_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object Extended Community List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_extended_community_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ extended_community = "soo 10.0.0.1:30"
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) Extended Community List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `extended_community` (String) can be soo 10.0.0.1:30 or rt 500:50 etc.
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_extended_community_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_feature_profile.md b/docs/resources/policy_object_feature_profile.md
new file mode 100644
index 00000000..237f4052
--- /dev/null
+++ b/docs/resources/policy_object_feature_profile.md
@@ -0,0 +1,40 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_feature_profile Resource - terraform-provider-sdwan"
+subcategory: "Feature Profiles"
+description: |-
+ This resource can manage a Policy Object Feature Profile .
+---
+
+# sdwan_policy_object_feature_profile (Resource)
+
+This resource can manage a Policy Object Feature Profile .
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_feature_profile" "example" {
+ name = "POLICY_OBJECT_FP_1"
+ description = "My policy object feature profile 1"
+}
+```
+
+
+## Schema
+
+### Required
+
+- `description` (String) Description
+- `name` (String) The name of the policy object feature profile
+
+### Read-Only
+
+- `id` (String) The id of the object
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_feature_profile.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_ipv4_prefix_list_profile_parcel.md b/docs/resources/policy_object_ipv4_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..5d26736f
--- /dev/null
+++ b/docs/resources/policy_object_ipv4_prefix_list_profile_parcel.md
@@ -0,0 +1,70 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_ipv4_prefix_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object IPv4 Prefix List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_ipv4_prefix_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object IPv4 Prefix List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv4_address = "10.0.0.0"
+ ipv4_prefix_length = 8
+ le = 24
+ ge = 16
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) IPv4 Prefix List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `ge` (Number) IPv4 prefix length with ge range operator
+ - Range: `1`-`32`
+- `ipv4_address` (String) IPv4 address
+- `ipv4_prefix_length` (Number) IPv4 prefix length
+ - Range: `0`-`32`
+- `le` (Number) IPv4 prefix length with le range operator
+ - Range: `1`-`32`
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_ipv4_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_ipv6_prefix_list_profile_parcel.md b/docs/resources/policy_object_ipv6_prefix_list_profile_parcel.md
new file mode 100644
index 00000000..18168101
--- /dev/null
+++ b/docs/resources/policy_object_ipv6_prefix_list_profile_parcel.md
@@ -0,0 +1,70 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_ipv6_prefix_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object IPv6 Prefix List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_ipv6_prefix_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object IPv6 Prefix List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv6_address = "2001:db8:85a3::8a2e:370:7334"
+ ipv6_prefix_length = 64
+ le = 100
+ ge = 70
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) IPv6 Prefix List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `ge` (Number) IPv6 prefix length with ge range operator
+ - Range: `1`-`128`
+- `ipv6_address` (String) IPv6 address
+- `ipv6_prefix_length` (Number) IPv6 prefix length
+ - Range: `0`-`128`
+- `le` (Number) IPv6 prefix length with le range operator
+ - Range: `1`-`128`
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_ipv6_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_mirror_profile_parcel.md b/docs/resources/policy_object_mirror_profile_parcel.md
new file mode 100644
index 00000000..9abeb439
--- /dev/null
+++ b/docs/resources/policy_object_mirror_profile_parcel.md
@@ -0,0 +1,63 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_mirror_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Mirror profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_mirror_profile_parcel (Resource)
+
+This resource can manage a Policy Object Mirror profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_mirror_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ remote_destination_ip = "10.0.0.1"
+ source_ip = "10.0.0.2"
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) Mirror List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `remote_destination_ip` (String) remote destination ip address
+- `source_ip` (String) source ip address
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_mirror_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_policer_profile_parcel.md b/docs/resources/policy_object_policer_profile_parcel.md
new file mode 100644
index 00000000..56dcd33f
--- /dev/null
+++ b/docs/resources/policy_object_policer_profile_parcel.md
@@ -0,0 +1,68 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_policer_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object Policer profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_policer_profile_parcel (Resource)
+
+This resource can manage a Policy Object Policer profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_policer_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ burst_bytes = 56500
+ exceed_action = "remark"
+ rate_bps = 60000
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) Policer Entries (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `burst_bytes` (Number) Burst (Bytes)
+ - Range: `15000`-`10000000`
+- `exceed_action` (String) Exceed options such as Drop or Remark
+ - Choices: `drop`, `remark`
+- `rate_bps` (Number) Rate (bps)
+ - Range: `8`-`100000000000`
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_policer_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/docs/resources/policy_object_tloc_list_profile_parcel.md b/docs/resources/policy_object_tloc_list_profile_parcel.md
new file mode 100644
index 00000000..fdd3241b
--- /dev/null
+++ b/docs/resources/policy_object_tloc_list_profile_parcel.md
@@ -0,0 +1,69 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "sdwan_policy_object_tloc_list_profile_parcel Resource - terraform-provider-sdwan"
+subcategory: "Profile Parcels"
+description: |-
+ This resource can manage a Policy Object TLOC List profile parcel.
+ Minimum SD-WAN Manager version: 20.12.0
+---
+
+# sdwan_policy_object_tloc_list_profile_parcel (Resource)
+
+This resource can manage a Policy Object TLOC List profile parcel.
+ - Minimum SD-WAN Manager version: `20.12.0`
+
+## Example Usage
+
+```terraform
+resource "sdwan_policy_object_tloc_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ tloc_ip = "10.0.0.0"
+ color = "3g"
+ encapsulation = "gre"
+ preference = "33"
+ }
+ ]
+}
+```
+
+
+## Schema
+
+### Required
+
+- `entries` (Attributes List) TLOC List (see [below for nested schema](#nestedatt--entries))
+- `feature_profile_id` (String) Feature Profile ID
+- `name` (String) The name of the profile parcel
+
+### Optional
+
+- `description` (String) The description of the profile parcel
+
+### Read-Only
+
+- `id` (String) The id of the profile parcel
+- `version` (Number) The version of the profile parcel
+
+
+### Nested Schema for `entries`
+
+Optional:
+
+- `color` (String) color
+ - Choices: `3g`, `biz-internet`, `blue`, `bronze`, `custom1`, `custom2`, `custom3`, `default`, `gold`, `green`, `lte`, `metro-ethernet`, `mpls`, `private1`, `private2`, `private3`, `private4`, `private5`, `private6`, `public-internet`, `red`, `silver`
+- `encapsulation` (String) encapsulation
+ - Choices: `ipsec`, `gre`
+- `preference` (String) Preference
+- `tloc_ip` (String) tloc
+
+## Import
+
+Import is supported using the following syntax:
+
+```shell
+terraform import sdwan_policy_object_tloc_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
+```
diff --git a/examples/data-sources/sdwan_policy_object_class_map_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_class_map_profile_parcel/data-source.tf
new file mode 100644
index 00000000..0746622e
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_class_map_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_class_map_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_color_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_color_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..af5e48f5
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_color_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_color_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_color_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_color_profile_parcel/data-source.tf
new file mode 100644
index 00000000..828c179e
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_color_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_color_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..3e6ac963
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..06f3df4e
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/data-source.tf
new file mode 100644
index 00000000..8f8dd249
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_data_prefix_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_data_prefix_profile_parcel/data-source.tf
new file mode 100644
index 00000000..b3902c5f
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_data_prefix_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_data_prefix_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_expanded_community_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_expanded_community_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..12edef1b
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_expanded_community_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_expanded_community_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_expanded_community_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_expanded_community_profile_parcel/data-source.tf
new file mode 100644
index 00000000..24bf6baa
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_expanded_community_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_expanded_community_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_extended_community_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_extended_community_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..b5fe70f1
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_extended_community_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_extended_community_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_extended_community_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_extended_community_profile_parcel/data-source.tf
new file mode 100644
index 00000000..94521604
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_extended_community_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_extended_community_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_feature_profile/data-source.tf b/examples/data-sources/sdwan_policy_object_feature_profile/data-source.tf
new file mode 100644
index 00000000..1a0ab476
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_feature_profile/data-source.tf
@@ -0,0 +1,3 @@
+data "sdwan_policy_object_feature_profile" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+}
diff --git a/examples/data-sources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..ce8f8c88
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..affc22e4
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_ipv6_prefix_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_ipv6_prefix_profile_parcel/data-source.tf
new file mode 100644
index 00000000..8797118c
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_ipv6_prefix_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_ipv6_prefix_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_mirror_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_mirror_profile_parcel/data-source.tf
new file mode 100644
index 00000000..14e842f9
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_mirror_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_mirror_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_policer_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_policer_profile_parcel/data-source.tf
new file mode 100644
index 00000000..138444d9
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_policer_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_policer_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_prefix_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_prefix_profile_parcel/data-source.tf
new file mode 100644
index 00000000..72ce05b9
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_prefix_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_prefix_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_tloc_list_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_tloc_list_profile_parcel/data-source.tf
new file mode 100644
index 00000000..1373a48d
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_tloc_list_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_tloc_list_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/data-sources/sdwan_policy_object_tloc_profile_parcel/data-source.tf b/examples/data-sources/sdwan_policy_object_tloc_profile_parcel/data-source.tf
new file mode 100644
index 00000000..672ce7f1
--- /dev/null
+++ b/examples/data-sources/sdwan_policy_object_tloc_profile_parcel/data-source.tf
@@ -0,0 +1,4 @@
+data "sdwan_policy_object_tloc_profile_parcel" "example" {
+ id = "f6b2c44c-693c-4763-b010-895aa3d236bd"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+}
diff --git a/examples/resources/sdwan_policy_object_class_map_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_class_map_profile_parcel/import.sh
new file mode 100644
index 00000000..7014d5ef
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_class_map_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_class_map_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_class_map_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_class_map_profile_parcel/resource.tf
new file mode 100644
index 00000000..d94f6a58
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_class_map_profile_parcel/resource.tf
@@ -0,0 +1,10 @@
+resource "sdwan_policy_object_class_map_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ queue = "0"
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_color_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_color_list_profile_parcel/import.sh
new file mode 100644
index 00000000..056b11dd
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_color_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_color_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_color_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_color_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..bb50af90
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_color_list_profile_parcel/resource.tf
@@ -0,0 +1,10 @@
+resource "sdwan_policy_object_color_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ color = "blue"
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_color_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_color_profile_parcel/import.sh
new file mode 100644
index 00000000..920f67ec
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_color_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_color_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_color_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_color_profile_parcel/resource.tf
new file mode 100644
index 00000000..e594fcf4
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_color_profile_parcel/resource.tf
@@ -0,0 +1,10 @@
+resource "sdwan_policy_object_color_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ color = "blue"
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/import.sh
new file mode 100644
index 00000000..c7c395ca
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..5f403724
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_ipv4_prefix_list_profile_parcel/resource.tf
@@ -0,0 +1,11 @@
+resource "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv4_address = "10.0.0.0"
+ ipv4_prefix_length = 8
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/import.sh
new file mode 100644
index 00000000..682e381c
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..56284aa8
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_ipv6_prefix_list_profile_parcel/resource.tf
@@ -0,0 +1,11 @@
+resource "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv6_address = "2001:db8:85a3::8a2e:370:7334"
+ ipv6_prefix_length = 64
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/import.sh
new file mode 100644
index 00000000..27c55f1c
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_data_ipv6_prefix_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/resource.tf
new file mode 100644
index 00000000..9bf9a200
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_ipv6_prefix_profile_parcel/resource.tf
@@ -0,0 +1,11 @@
+resource "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv6_address = "2001:db8:85a3::8a2e:370:7334"
+ ipv6_prefix_length = 64
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_data_prefix_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_data_prefix_profile_parcel/import.sh
new file mode 100644
index 00000000..aa2154d5
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_prefix_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_data_prefix_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_data_prefix_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_data_prefix_profile_parcel/resource.tf
new file mode 100644
index 00000000..8d5afe0a
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_data_prefix_profile_parcel/resource.tf
@@ -0,0 +1,11 @@
+resource "sdwan_policy_object_data_prefix_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv4_address = "10.0.0.0"
+ ipv4_prefix_length = 8
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_expanded_community_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_expanded_community_list_profile_parcel/import.sh
new file mode 100644
index 00000000..31aed67f
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_expanded_community_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_expanded_community_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_expanded_community_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_expanded_community_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..358fc731
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_expanded_community_list_profile_parcel/resource.tf
@@ -0,0 +1,6 @@
+resource "sdwan_policy_object_expanded_community_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ expanded_community_lists = ["abcd"]
+}
diff --git a/examples/resources/sdwan_policy_object_expanded_community_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_expanded_community_profile_parcel/import.sh
new file mode 100644
index 00000000..fbec665e
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_expanded_community_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_expanded_community_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_expanded_community_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_expanded_community_profile_parcel/resource.tf
new file mode 100644
index 00000000..f5711a2b
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_expanded_community_profile_parcel/resource.tf
@@ -0,0 +1,6 @@
+resource "sdwan_policy_object_expanded_community_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ expanded_community_lists = ["abcd"]
+}
diff --git a/examples/resources/sdwan_policy_object_extended_community_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_extended_community_list_profile_parcel/import.sh
new file mode 100644
index 00000000..2e4a7b14
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_extended_community_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_extended_community_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_extended_community_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_extended_community_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..fe3da1c1
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_extended_community_list_profile_parcel/resource.tf
@@ -0,0 +1,10 @@
+resource "sdwan_policy_object_extended_community_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ extended_community = "soo 10.0.0.1:30"
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_extended_community_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_extended_community_profile_parcel/import.sh
new file mode 100644
index 00000000..d656bda3
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_extended_community_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_extended_community_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_extended_community_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_extended_community_profile_parcel/resource.tf
new file mode 100644
index 00000000..d009e8c5
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_extended_community_profile_parcel/resource.tf
@@ -0,0 +1,10 @@
+resource "sdwan_policy_object_extended_community_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ extended_community = "soo 10.0.0.1:30"
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_feature_profile/import.sh b/examples/resources/sdwan_policy_object_feature_profile/import.sh
new file mode 100644
index 00000000..ee4f5422
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_feature_profile/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_feature_profile.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_feature_profile/resource.tf b/examples/resources/sdwan_policy_object_feature_profile/resource.tf
new file mode 100644
index 00000000..531f4201
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_feature_profile/resource.tf
@@ -0,0 +1,4 @@
+resource "sdwan_policy_object_feature_profile" "example" {
+ name = "POLICY_OBJECT_FP_1"
+ description = "My policy object feature profile 1"
+}
diff --git a/examples/resources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/import.sh
new file mode 100644
index 00000000..4a91ea84
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_ipv4_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..d7ac927a
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_ipv4_prefix_list_profile_parcel/resource.tf
@@ -0,0 +1,13 @@
+resource "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv4_address = "10.0.0.0"
+ ipv4_prefix_length = 8
+ le = 24
+ ge = 16
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/import.sh
new file mode 100644
index 00000000..2e556cb5
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_ipv6_prefix_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..53417120
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_ipv6_prefix_list_profile_parcel/resource.tf
@@ -0,0 +1,13 @@
+resource "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv6_address = "2001:db8:85a3::8a2e:370:7334"
+ ipv6_prefix_length = 64
+ le = 100
+ ge = 70
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_ipv6_prefix_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_ipv6_prefix_profile_parcel/import.sh
new file mode 100644
index 00000000..1368cbe2
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_ipv6_prefix_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_ipv6_prefix_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_ipv6_prefix_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_ipv6_prefix_profile_parcel/resource.tf
new file mode 100644
index 00000000..5d54e08a
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_ipv6_prefix_profile_parcel/resource.tf
@@ -0,0 +1,13 @@
+resource "sdwan_policy_object_ipv6_prefix_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv6_address = "2001:db8:85a3::8a2e:370:7334"
+ ipv6_prefix_length = 64
+ le_range_prefix_length = 100
+ ge_range_prefix_length = 70
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_mirror_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_mirror_profile_parcel/import.sh
new file mode 100644
index 00000000..b14cd0f2
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_mirror_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_mirror_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_mirror_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_mirror_profile_parcel/resource.tf
new file mode 100644
index 00000000..5fd2a7bc
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_mirror_profile_parcel/resource.tf
@@ -0,0 +1,11 @@
+resource "sdwan_policy_object_mirror_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ remote_destination_ip = "10.0.0.1"
+ source_ip = "10.0.0.2"
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_policer_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_policer_profile_parcel/import.sh
new file mode 100644
index 00000000..caccbab6
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_policer_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_policer_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_policer_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_policer_profile_parcel/resource.tf
new file mode 100644
index 00000000..ebd5c5f6
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_policer_profile_parcel/resource.tf
@@ -0,0 +1,12 @@
+resource "sdwan_policy_object_policer_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ burst_bytes = 56500
+ exceed_action = "remark"
+ rate_bps = 60000
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_prefix_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_prefix_profile_parcel/import.sh
new file mode 100644
index 00000000..a3c6cb6d
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_prefix_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_prefix_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_prefix_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_prefix_profile_parcel/resource.tf
new file mode 100644
index 00000000..ad8fdb23
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_prefix_profile_parcel/resource.tf
@@ -0,0 +1,13 @@
+resource "sdwan_policy_object_prefix_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ ipv4_address = "10.0.0.0"
+ ipv4_prefix_length = 8
+ le_range_prefix_length = 24
+ ge_range_prefix_length = 16
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_tloc_list_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_tloc_list_profile_parcel/import.sh
new file mode 100644
index 00000000..9faa9b1a
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_tloc_list_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_tloc_list_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_tloc_list_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_tloc_list_profile_parcel/resource.tf
new file mode 100644
index 00000000..c2f06817
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_tloc_list_profile_parcel/resource.tf
@@ -0,0 +1,13 @@
+resource "sdwan_policy_object_tloc_list_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ tloc_ip = "10.0.0.0"
+ color = "3g"
+ encapsulation = "gre"
+ preference = "33"
+ }
+ ]
+}
diff --git a/examples/resources/sdwan_policy_object_tloc_profile_parcel/import.sh b/examples/resources/sdwan_policy_object_tloc_profile_parcel/import.sh
new file mode 100644
index 00000000..ed141a0a
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_tloc_profile_parcel/import.sh
@@ -0,0 +1 @@
+terraform import sdwan_policy_object_tloc_profile_parcel.example "f6b2c44c-693c-4763-b010-895aa3d236bd"
diff --git a/examples/resources/sdwan_policy_object_tloc_profile_parcel/resource.tf b/examples/resources/sdwan_policy_object_tloc_profile_parcel/resource.tf
new file mode 100644
index 00000000..776e27bc
--- /dev/null
+++ b/examples/resources/sdwan_policy_object_tloc_profile_parcel/resource.tf
@@ -0,0 +1,13 @@
+resource "sdwan_policy_object_tloc_profile_parcel" "example" {
+ name = "Example"
+ description = "My Example"
+ feature_profile_id = "f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac"
+ entries = [
+ {
+ tloc = "10.0.0.0"
+ color = "3g"
+ encapsulation = "gre"
+ preference = "33"
+ }
+ ]
+}
diff --git a/gen/definitions/generic/policy_object_feature_profile.yaml b/gen/definitions/generic/policy_object_feature_profile.yaml
new file mode 100644
index 00000000..690d67f9
--- /dev/null
+++ b/gen/definitions/generic/policy_object_feature_profile.yaml
@@ -0,0 +1,18 @@
+---
+name: Policy Object Feature Profile
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/
+id_attribute: id
+doc_category: Feature Profiles
+test_tags: [SDWAN_2012]
+attributes:
+ - model_name: name
+ response_model_name: profileName
+ type: String
+ mandatory: true
+ description: The name of the policy object feature profile
+ example: POLICY_OBJECT_FP_1
+ - model_name: description
+ type: String
+ mandatory: true
+ description: Description
+ example: My policy object feature profile 1
diff --git a/gen/definitions/profile_parcels/policy_object_class_map.yaml b/gen/definitions/profile_parcels/policy_object_class_map.yaml
new file mode 100644
index 00000000..49341d99
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_class_map.yaml
@@ -0,0 +1,24 @@
+---
+name: Policy Object Class Map
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/class
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: queue
+ id: true
+ mandatory: true
+ example: 0
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
\ No newline at end of file
diff --git a/gen/definitions/profile_parcels/policy_object_color_list.yaml b/gen/definitions/profile_parcels/policy_object_color_list.yaml
new file mode 100644
index 00000000..be54ca97
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_color_list.yaml
@@ -0,0 +1,24 @@
+---
+name: Policy Object Color List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/color
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: color
+ id: true
+ mandatory: true
+ example: blue
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
\ No newline at end of file
diff --git a/gen/definitions/profile_parcels/policy_object_data_ipv4_prefix_list.yaml b/gen/definitions/profile_parcels/policy_object_data_ipv4_prefix_list.yaml
new file mode 100644
index 00000000..3f2ea024
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_data_ipv4_prefix_list.yaml
@@ -0,0 +1,27 @@
+---
+name: Policy Object Data IPv4 Prefix List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/data-prefix
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: ipv4Address
+ id: true
+ mandatory: true
+ example: 10.0.0.0
+ - model_name: ipv4PrefixLength
+ mandatory: true
+ example: 8
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
\ No newline at end of file
diff --git a/gen/definitions/profile_parcels/policy_object_data_ipv6_prefix_list.yaml b/gen/definitions/profile_parcels/policy_object_data_ipv6_prefix_list.yaml
new file mode 100644
index 00000000..dfae8df7
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_data_ipv6_prefix_list.yaml
@@ -0,0 +1,27 @@
+---
+name: Policy Object Data IPv6 Prefix List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/data-ipv6-prefix
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: ipv6Address
+ id: true
+ mandatory: true
+ example: 2001:db8:85a3::8a2e:370:7334
+ - model_name: ipv6PrefixLength
+ mandatory: true
+ example: 64
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
diff --git a/gen/definitions/profile_parcels/policy_object_expanded_community_list.yaml b/gen/definitions/profile_parcels/policy_object_expanded_community_list.yaml
new file mode 100644
index 00000000..4ac03843
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_expanded_community_list.yaml
@@ -0,0 +1,22 @@
+---
+name: Policy Object Expanded Community List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/expanded-community
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: expandedCommunityList
+ tf_name: expanded_community_lists
+ id: true
+ mandatory: true
+ example: abcd
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
diff --git a/gen/definitions/profile_parcels/policy_object_extended_community_list.yaml b/gen/definitions/profile_parcels/policy_object_extended_community_list.yaml
new file mode 100644
index 00000000..94644a33
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_extended_community_list.yaml
@@ -0,0 +1,25 @@
+---
+name: Policy Object Extended Community List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/ext-community
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: extCommunity
+ tf_name: extended_community
+ id: true
+ mandatory: true
+ example: "soo 10.0.0.1:30"
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
diff --git a/gen/definitions/profile_parcels/policy_object_ipv4_prefix_list.yaml b/gen/definitions/profile_parcels/policy_object_ipv4_prefix_list.yaml
new file mode 100644
index 00000000..904f4078
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_ipv4_prefix_list.yaml
@@ -0,0 +1,35 @@
+---
+name: Policy Object IPv4 Prefix List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/prefix
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: ipv4Address
+ id: true
+ mandatory: true
+ example: 10.0.0.0
+ minimum_test_value: '"10.0.0.0"'
+ - model_name: ipv4PrefixLength
+ id: true
+ mandatory: true
+ example: 8
+ minimum_test_value: '8'
+ - model_name: leRangePrefixLength
+ tf_name: le
+ example: 24
+ - model_name: geRangePrefixLength
+ tf_name: ge
+ example: 16
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
\ No newline at end of file
diff --git a/gen/definitions/profile_parcels/policy_object_ipv6_prefix_list.yaml b/gen/definitions/profile_parcels/policy_object_ipv6_prefix_list.yaml
new file mode 100644
index 00000000..76845715
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_ipv6_prefix_list.yaml
@@ -0,0 +1,35 @@
+---
+name: Policy Object IPv6 Prefix List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/ipv6-prefix
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: ipv6Address
+ id: true
+ mandatory: true
+ example: 2001:db8:85a3::8a2e:370:7334
+ minimum_test_value: '"2001:db8:85a3::8a2e:370:7334"'
+ - model_name: ipv6PrefixLength
+ id: true
+ mandatory: true
+ example: 64
+ minimum_test_value: '64'
+ - model_name: leRangePrefixLength
+ tf_name: le
+ example: 100
+ - model_name: geRangePrefixLength
+ tf_name: ge
+ example: 70
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
diff --git a/gen/definitions/profile_parcels/policy_object_mirror.yaml b/gen/definitions/profile_parcels/policy_object_mirror.yaml
new file mode 100644
index 00000000..8a687e7b
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_mirror.yaml
@@ -0,0 +1,30 @@
+---
+name: Policy Object Mirror
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/mirror
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: remoteDestIp
+ tf_name: remote_destination_ip
+ id: true
+ mandatory: true
+ example: 10.0.0.1
+ - model_name: sourceIp
+ tf_name: source_ip
+ id: true
+ mandatory: true
+ example: 10.0.0.2
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
\ No newline at end of file
diff --git a/gen/definitions/profile_parcels/policy_object_policer.yaml b/gen/definitions/profile_parcels/policy_object_policer.yaml
new file mode 100644
index 00000000..514a8f57
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_policer.yaml
@@ -0,0 +1,35 @@
+---
+name: Policy Object Policer
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/policer
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: burst
+ tf_name: burst_bytes
+ id: true
+ mandatory: true
+ example: 56500
+ - model_name: exceed
+ tf_name: exceed_action
+ id: true
+ mandatory: true
+ example: remark
+ - model_name: rate
+ tf_name: rate_bps
+ id: true
+ mandatory: true
+ example: 60000
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
diff --git a/gen/definitions/profile_parcels/policy_object_tloc_list.yaml b/gen/definitions/profile_parcels/policy_object_tloc_list.yaml
new file mode 100644
index 00000000..b48518d2
--- /dev/null
+++ b/gen/definitions/profile_parcels/policy_object_tloc_list.yaml
@@ -0,0 +1,34 @@
+---
+name: Policy Object TLOC List
+rest_endpoint: /v1/feature-profile/sdwan/policy-object/%v/tloc
+minimum_version: 20.12.0
+test_tags: [SDWAN_2012, TF_VAR_policy_object_feature_template_id]
+skip_minimum_test: true
+attributes:
+ - tf_name: feature_profile_id
+ reference: true
+ type: String
+ mandatory: true
+ description: Feature Profile ID
+ example: f6dd22c8-0b4f-496c-9a0b-6813d1f8b8ac
+ test_value: var.policy_object_feature_template_id
+ - model_name: entries
+ mandatory: true
+ attributes:
+ - model_name: tloc
+ tf_name: tloc_ip
+ id: true
+ mandatory: true
+ example: 10.0.0.0
+ - model_name: color
+ mandatory: true
+ example: 3g
+ - model_name: encap
+ tf_name: encapsulation
+ mandatory: true
+ example: gre
+ - model_name: preference
+ example: 33
+
+test_prerequisites: |
+ variable "policy_object_feature_template_id" {}
diff --git a/gen/generator.go b/gen/generator.go
index 59f765ce..fd4b4548 100644
--- a/gen/generator.go
+++ b/gen/generator.go
@@ -680,6 +680,7 @@ func parseProfileParcelAttribute(attr *YamlConfigAttribute, model gjson.Result,
if attr.ModelName == "" {
return
}
+
path := ""
for i, e := range attr.DataPath {
// Check if the next element is a oneOf
diff --git a/gen/models/profile_parcels/policy_object_app_list.json b/gen/models/profile_parcels/policy_object_app_list.json
new file mode 100644
index 00000000..5ab182a6
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_app_list.json
@@ -0,0 +1,101 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/centralized-applist/post/request_schema.json",
+ "title": "Centralized Policy App List Parcel Schema",
+ "description": "Centralized Policy App List profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Centralized Policy App List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "app": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesAppOptionsDef"
+ },
+ "appFamily": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesAppFamilyOptionsDef"
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "app"
+ ]
+ },
+ {
+ "required": [
+ "appFamily"
+ ]
+ }
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for Centralized Policy App 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": [
+ {
+ "app": {
+ "optionType": "global",
+ "value": "3com-amp3"
+ }
+ },
+ {
+ "appFamily": {
+ "optionType": "global",
+ "value": "web"
+ }
+ }
+ ]
+ },
+ "name": "centralized-appListParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_app_probe.json b/gen/models/profile_parcels/policy_object_app_probe.json
new file mode 100644
index 00000000..5842c13b
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_app_probe.json
@@ -0,0 +1,201 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/app-probe/post/request_schema.json",
+ "title": "app-probe Parcel Schema",
+ "description": "app-probe profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "minLength": 1,
+ "maxLength": 32,
+ "pattern": "^[^&<>! \"]+$",
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "App Probe List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "map": {
+ "description": "Map",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "color": {
+ "description": "Color",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "3g",
+ "biz-internet",
+ "blue",
+ "bronze",
+ "custom1",
+ "custom2",
+ "custom3",
+ "default",
+ "gold",
+ "green",
+ "lte",
+ "metro-ethernet",
+ "mpls",
+ "private1",
+ "private2",
+ "private3",
+ "private4",
+ "private5",
+ "private6",
+ "public-internet",
+ "red",
+ "silver"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "dscp": {
+ "description": "DSCP number",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 0,
+ "maximum": 63,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "color"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "forwardingClass": {
+ "description": "Forwarding Class Name",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "map",
+ "forwardingClass"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for app-probe 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": [
+ {
+ "map": [
+ {
+ "color": {
+ "optionType": "global",
+ "value": "3g"
+ },
+ "dscp": {
+ "optionType": "global",
+ "value": 45
+ }
+ }
+ ],
+ "forwardingClass": {
+ "optionType": "global",
+ "value": "classlist1"
+ }
+ }
+ ]
+ },
+ "name": "app-probeParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_as_path.json b/gen/models/profile_parcels/policy_object_as_path.json
new file mode 100644
index 00000000..51dcce39
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_as_path.json
@@ -0,0 +1,147 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/as-path/common/request_schema.json",
+ "title": "AS Path Parcel Schema",
+ "description": "as path profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 128
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "asPathListNum": {
+ "type": "object",
+ "description": "As path List Number",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 500
+ }
+ }
+ },
+ "entries": {
+ "description": "AS Path List",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "asPath": {
+ "description": "",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "[^<>]*"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "asPath"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries",
+ "asPathListNum"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for AS Path 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": {
+ "asPathListNum": {
+ "optionType": "global",
+ "value": 1
+ },
+ "entries": [
+ {
+ "asPath": {
+ "optionType": "global",
+ "value": 110
+ }
+ },
+ {
+ "asPath": {
+ "optionType": "global",
+ "value": 220
+ }
+ }
+ ]
+ },
+ "name": "asPath1"
+ },
+ {
+ "data": {
+ "asPathListNum": {
+ "optionType": "global",
+ "value": 2
+ },
+ "entries": [
+ {
+ "asPath": {
+ "optionType": "global",
+ "value": 1100
+ }
+ },
+ {
+ "asPath": {
+ "optionType": "global",
+ "value": 2200
+ }
+ }
+ ]
+ },
+ "name": "asPath2"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_class_map.json b/gen/models/profile_parcels/policy_object_class_map.json
new file mode 100644
index 00000000..d528864f
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_class_map.json
@@ -0,0 +1,107 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/class/common/request_schema.json",
+ "title": "Class Map Parcel Schema",
+ "description": "class profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 128
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "class map List",
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "queue": {
+ "description": "select a queue",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "0",
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "queue"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for class 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": [
+ {
+ "queue": {
+ "optionType": "global",
+ "value": "1"
+ }
+ }
+ ]
+ },
+ "name": "classMapList1"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_color_list.json b/gen/models/profile_parcels/policy_object_color_list.json
new file mode 100644
index 00000000..3d32d2fd
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_color_list.json
@@ -0,0 +1,121 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/color/post/request_schema.json",
+ "title": "color Parcel Schema",
+ "description": "color profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Color List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "color": {
+ "description": "",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "3g",
+ "biz-internet",
+ "blue",
+ "bronze",
+ "custom1",
+ "custom2",
+ "custom3",
+ "default",
+ "gold",
+ "green",
+ "lte",
+ "metro-ethernet",
+ "mpls",
+ "private1",
+ "private2",
+ "private3",
+ "private4",
+ "private5",
+ "private6",
+ "public-internet",
+ "red",
+ "silver"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "color"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for color 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": [
+ {
+ "color": {
+ "optionType": "global",
+ "value": "3g"
+ }
+ }
+ ]
+ },
+ "name": "colorParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_data_ipv4_prefix_list.json b/gen/models/profile_parcels/policy_object_data_ipv4_prefix_list.json
new file mode 100644
index 00000000..f00dd6e1
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_data_ipv4_prefix_list.json
@@ -0,0 +1,122 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/data-prefix/post/request_schema.json",
+ "title": "Ipv4 Data Prefix Parcel Schema",
+ "description": "ipv4 data prefix profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "IPv4 Data Prefix List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "ipv4Address": {
+ "description": "IPv4 address",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "format": "ipv4"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "ipv4PrefixLength": {
+ "description": "IPv4 prefix Length",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 0,
+ "maximum": 32,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "ipv4Address",
+ "ipv4PrefixLength"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for ipv4 data prefix 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": [
+ {
+ "ipv4Address": {
+ "optionType": "global",
+ "value": "10.0.0.0"
+ },
+ "ipv4PrefixLength": {
+ "optionType": "global",
+ "value": 8
+ }
+ }
+ ]
+ },
+ "name": "Ipv4DataPrefixList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_data_ipv6_prefix_list.json b/gen/models/profile_parcels/policy_object_data_ipv6_prefix_list.json
new file mode 100644
index 00000000..c0f1baac
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_data_ipv6_prefix_list.json
@@ -0,0 +1,122 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/data-ipv6-prefix/post/request_schema.json",
+ "title": "Ipv6 Data Prefix Parcel Schema",
+ "description": "Ipv6 data prefix profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "IPv6 Prefix List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "ipv6Address": {
+ "description": "IPv6 address",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "format": "ipv6"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "ipv6PrefixLength": {
+ "description": "IPv6 prefix",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 0,
+ "maximum": 128,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "ipv6Address",
+ "ipv6PrefixLength"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for ipv6 data prefix 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": [
+ {
+ "ipv6Address": {
+ "optionType": "global",
+ "value": "2001:db8:85a3::8a2e:370:7334"
+ },
+ "ipv6PrefixLength": {
+ "optionType": "global",
+ "value": 64
+ }
+ }
+ ]
+ },
+ "name": "Ipv6DataPrefixList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_expanded_community_list.json b/gen/models/profile_parcels/policy_object_expanded_community_list.json
new file mode 100644
index 00000000..208ab281
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_expanded_community_list.json
@@ -0,0 +1,110 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/expanded-community/common/request_schema.json",
+ "title": "Expanded Community List Parcel Schema",
+ "description": "expanded Community list profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "minProperties": 1,
+ "properties": {
+ "expandedCommunityList": {
+ "description": "Expanded Community List",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "array",
+ "items": {
+ "uniqueItems": true,
+ "type": "string",
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "variable"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "^\\{\\{[.\/\\[\\]a-zA-Z0-9_-]+\\}\\}$",
+ "minLength": 1,
+ "maxLength": 64
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "expandedCommunityList"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for expanded community 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": {
+ "expandedCommunityList": {
+ "optionType": "global",
+ "value": [
+ "123456any",
+ "abcd"
+ ]
+ }
+ },
+ "name": "expandedCommunityList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_extended_community_list.json b/gen/models/profile_parcels/policy_object_extended_community_list.json
new file mode 100644
index 00000000..a233a60c
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_extended_community_list.json
@@ -0,0 +1,102 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/ext-community/common/request_schema.json",
+ "title": "Extended Community List Parcel Schema",
+ "description": "extended community list profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 128
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Extended Community List",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "extCommunity": {
+ "description": "can be soo 10.0.0.1:30 or rt 500:50 etc.",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "^(rt|soo) ([\\d\\.]+):(\\d+)$"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "extCommunity"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for extended community 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": [
+ {
+ "extCommunity": {
+ "optionType": "global",
+ "value": "soo 10.0.0.1:30"
+ }
+ },
+ {
+ "extCommunity": {
+ "optionType": "global",
+ "value": "rt 500:50"
+ }
+ }
+ ]
+ },
+ "name": "extCommunityList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_ipv4_prefix_list.json b/gen/models/profile_parcels/policy_object_ipv4_prefix_list.json
new file mode 100644
index 00000000..aa40bb72
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_ipv4_prefix_list.json
@@ -0,0 +1,176 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/prefix/common/request_schema.json",
+ "title": "Ipv4 Prefix Parcel Schema",
+ "description": "Ipv4 prefix profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "IPv4 Prefix List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "ipv4Address": {
+ "description": "IPv4 address",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "format": "ipv4"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "ipv4PrefixLength": {
+ "description": "IPv4 prefix length",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 0,
+ "maximum": 32,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "leRangePrefixLength": {
+ "description": "IPv4 prefix length with le range operator",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 1,
+ "maximum": 32,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "geRangePrefixLength": {
+ "description": "IPv4 prefix length with ge range operator",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 1,
+ "maximum": 32,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "ipv4Address",
+ "ipv4PrefixLength"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for ipv4 prefix 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": [
+ {
+ "ipv4Address": {
+ "optionType": "global",
+ "value": "10.0.0.0"
+ },
+ "ipv4PrefixLength": {
+ "optionType": "global",
+ "value": 8
+ },
+ "leRangePrefixLength": {
+ "optionType": "global",
+ "value": 24
+ },
+ "geRangePrefixLength": {
+ "optionType": "global",
+ "value": 16
+ }
+ }
+ ]
+ },
+ "name": "Ipv4PrefixList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_ipv6_prefix_list.json b/gen/models/profile_parcels/policy_object_ipv6_prefix_list.json
new file mode 100644
index 00000000..49462649
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_ipv6_prefix_list.json
@@ -0,0 +1,176 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/ipv6-prefix/common/request_schema.json",
+ "title": "Ipv6 Prefix Parcel Schema",
+ "description": "Ipv6 prefix profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 128
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "IPv6 Prefix List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "ipv6Address": {
+ "description": "IPv6 address",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "format": "ipv6"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "ipv6PrefixLength": {
+ "description": "IPv6 prefix length",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 0,
+ "maximum": 128,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "leRangePrefixLength": {
+ "description": "IPv6 prefix length with le range operator",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 1,
+ "maximum": 128,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "geRangePrefixLength": {
+ "description": "IPv6 prefix length with ge range operator",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 1,
+ "maximum": 128,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "ipv6Address",
+ "ipv6PrefixLength"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for ipv6 prefix 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": [
+ {
+ "ipv6Address": {
+ "optionType": "global",
+ "value": "2001:db8:85a3::8a2e:370:7334"
+ },
+ "ipv6PrefixLength": {
+ "optionType": "global",
+ "value": 64
+ },
+ "leRangePrefixLength": {
+ "optionType": "global",
+ "value": 100
+ },
+ "geRangePrefixLength": {
+ "optionType": "global",
+ "value": 70
+ }
+ }
+ ]
+ },
+ "name": "Ipv6PrefixList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_mirror.json b/gen/models/profile_parcels/policy_object_mirror.json
new file mode 100644
index 00000000..f0e126e5
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_mirror.json
@@ -0,0 +1,155 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/mirror/post/request_schema.json",
+ "title": "Mirror Parcel Schema",
+ "description": "mirror profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 128
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Mirror List",
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "remoteDestIp": {
+ "description": "remote destination ip address",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "oneOf": [
+ {
+ "format": "ipv4"
+ },
+ {
+ "format": "ipv6"
+ }
+ ]
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "sourceIp": {
+ "description": "source ip address",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "oneOf": [
+ {
+ "format": "ipv4"
+ },
+ {
+ "format": "ipv6"
+ }
+ ]
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "remoteDestIp",
+ "sourceIp"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for mirror 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": [
+ {
+ "remoteDestIp": {
+ "optionType": "global",
+ "value": "10.0.0.1"
+ },
+ "sourceIp": {
+ "optionType": "global",
+ "value": "10.0.0.2"
+ }
+ }
+ ]
+ },
+ "name": "mirrorList1"
+ },
+ {
+ "data": {
+ "entries": [
+ {
+ "remoteDestIp": {
+ "optionType": "global",
+ "value": "10.0.0.1"
+ },
+ "sourceIp": {
+ "optionType": "global",
+ "value": "2001:0db8:85a3:0000:0000:8a2e:0370:7334"
+ }
+ }
+ ]
+ },
+ "name": "mirrorList2"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_policer.json b/gen/models/profile_parcels/policy_object_policer.json
new file mode 100644
index 00000000..fa22819d
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_policer.json
@@ -0,0 +1,155 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/policer/post/request_schema.json",
+ "title": "Policer Parcel Schema",
+ "description": "policer profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Policer Entries",
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "burst": {
+ "description": "Burst (Bytes)",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 15000,
+ "maximum": 10000000,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "exceed": {
+ "description": "Exceed options such as Drop or Remark",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "drop",
+ "remark"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ "rate": {
+ "description": "Rate (bps)",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "minimum": 8,
+ "maximum": 100000000000,
+ "type": "integer"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "burst",
+ "exceed",
+ "rate"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for policer 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": [
+ {
+ "burst": {
+ "optionType": "global",
+ "value": 56500
+ },
+ "exceed": {
+ "optionType": "global",
+ "value": "remark"
+ },
+ "rate": {
+ "optionType": "global",
+ "value": 60000
+ }
+ }
+ ]
+ },
+ "name": "PolicerList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_preferred_color_group.json b/gen/models/profile_parcels/policy_object_preferred_color_group.json
new file mode 100644
index 00000000..ed03de4c
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_preferred_color_group.json
@@ -0,0 +1,360 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/preferred-color-group/post/request_schema.json",
+ "title": "preferred-color-group Parcel Schema",
+ "description": "preferred-color-group profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "minLength": 1,
+ "maxLength": 32,
+ "pattern": "^[^&<>! \"]+$",
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Preferred Color Group List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "primaryPreference": {
+ "description": "Object with an color and path preference",
+ "type": "object",
+ "properties": {
+ "colorPreference": {
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "enum": [
+ "default",
+ "3g",
+ "biz-internet",
+ "blue",
+ "bronze",
+ "custom1",
+ "custom2",
+ "custom3",
+ "gold",
+ "green",
+ "lte",
+ "metro-ethernet",
+ "mpls",
+ "private1",
+ "private2",
+ "private3",
+ "private4",
+ "private5",
+ "private6",
+ "public-internet",
+ "red",
+ "silver"
+ ],
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "pathPreference": {
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "all-paths",
+ "direct-path",
+ "multi-hop-path"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ }
+ },
+ "secondaryPreference": {
+ "description": "Object with an color and path preference",
+ "type": "object",
+ "properties": {
+ "colorPreference": {
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "enum": [
+ "default",
+ "3g",
+ "biz-internet",
+ "blue",
+ "bronze",
+ "custom1",
+ "custom2",
+ "custom3",
+ "gold",
+ "green",
+ "lte",
+ "metro-ethernet",
+ "mpls",
+ "private1",
+ "private2",
+ "private3",
+ "private4",
+ "private5",
+ "private6",
+ "public-internet",
+ "red",
+ "silver"
+ ],
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "pathPreference": {
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "all-paths",
+ "direct-path",
+ "multi-hop-path"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ }
+ },
+ "tertiaryPreference": {
+ "description": "Object with an color and path preference",
+ "type": "object",
+ "properties": {
+ "colorPreference": {
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "enum": [
+ "default",
+ "3g",
+ "biz-internet",
+ "blue",
+ "bronze",
+ "custom1",
+ "custom2",
+ "custom3",
+ "gold",
+ "green",
+ "lte",
+ "metro-ethernet",
+ "mpls",
+ "private1",
+ "private2",
+ "private3",
+ "private4",
+ "private5",
+ "private6",
+ "public-internet",
+ "red",
+ "silver"
+ ],
+ "type": "string"
+ }
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "pathPreference": {
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "all-paths",
+ "direct-path",
+ "multi-hop-path"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ }
+ }
+ },
+ "required": [
+ "primaryPreference"
+ ],
+ "dependentRequired": {
+ "secondaryPreference": [
+ "primaryPreference"
+ ],
+ "tertiaryPreference": [
+ "primaryPreference",
+ "secondaryPreference"
+ ]
+ },
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for preferred-color-group 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": [
+ {
+ "primaryPreference": {
+ "colorPreference": {
+ "optionType": "global",
+ "value": "default 3g biz-internet"
+ },
+ "pathPreference": {
+ "optionType": "global",
+ "value": "direct-path"
+ }
+ },
+ "secondaryPreference": {
+ "colorPreference": {
+ "optionType": "global",
+ "value": "bronze blue"
+ },
+ "pathPreference": {
+ "optionType": "global",
+ "value": "all-paths"
+ }
+ },
+ "tertiaryPreference": {
+ "colorPreference": {
+ "optionType": "global",
+ "value": "bronze blue"
+ },
+ "pathPreference": {
+ "optionType": "global",
+ "value": "all-paths"
+ }
+ }
+ }
+ ]
+ },
+ "name": "preferred-color-groupParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_data_ip_prefix.json b/gen/models/profile_parcels/policy_object_security_data_ip_prefix.json
new file mode 100644
index 00000000..89f68d4f
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_data_ip_prefix.json
@@ -0,0 +1,120 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-data-ip-prefix/post/request_schema.json",
+ "title": "security-data-ip-prefix Parcel Schema",
+ "description": "security-data-ip-prefix profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "ipPrefix": {
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/)([0-2]?[0-9]$|[3]?[0-2])"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ },
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "variable"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "^\\{\\{[.\/\\[\\]a-zA-Z0-9_-]+\\}\\}$",
+ "minLength": 1,
+ "maxLength": 64
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "ipPrefix"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-data-ip-prefix 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": [
+ {
+ "ipPrefix": {
+ "optionType": "global",
+ "value": "10.0.0.0/12"
+ }
+ }
+ ]
+ },
+ "name": "security-data-ip-prefixParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_fqdn.json b/gen/models/profile_parcels/policy_object_security_fqdn.json
new file mode 100644
index 00000000..e4d76457
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_fqdn.json
@@ -0,0 +1,103 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-fqdn/post/request_schema.json",
+ "title": "security-fqdn Parcel Schema",
+ "description": "security-data-fqdn-prefix profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "type": "array",
+ "maxItems": 64,
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "pattern": {
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "description": "Must be valid FQDN",
+ "pattern": "^([*][.])?(([a-zA-Z0-9-]+.)+)?([a-zA-Z0-9-])+$",
+ "minLength": 1,
+ "maxLength": 120
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "pattern"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-data-fqdn-prefix 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": "cisco.com"
+ }
+ }
+ ]
+ },
+ "name": "security-data-fqdn-prefixParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_geolocation.json b/gen/models/profile_parcels/policy_object_security_geolocation.json
new file mode 100644
index 00000000..f1b7bdb4
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_geolocation.json
@@ -0,0 +1,393 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-geolocation/post/request_schema.json",
+ "title": "Geolocation Parcel Schema",
+ "description": "Geolocation profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Geolocation List",
+ "type": "array",
+ "maxItems": 64,
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "country": {
+ "description": "country names",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "AFG",
+ "ALB",
+ "ATA",
+ "DZA",
+ "ASM",
+ "AND",
+ "AGO",
+ "ATG",
+ "AZE",
+ "ARG",
+ "AUS",
+ "AUT",
+ "BHS",
+ "BHR",
+ "BGD",
+ "ARM",
+ "BRB",
+ "BEL",
+ "BMU",
+ "BTN",
+ "BOL",
+ "BIH",
+ "BWA",
+ "BVT",
+ "BRA",
+ "BLZ",
+ "IOT",
+ "SLB",
+ "VGB",
+ "BRN",
+ "BGR",
+ "MMR",
+ "BDI",
+ "BLR",
+ "KHM",
+ "CMR",
+ "CAN",
+ "CPV",
+ "CYM",
+ "CAF",
+ "LKA",
+ "TCD",
+ "CHL",
+ "CHN",
+ "TWN",
+ "CXR",
+ "CCK",
+ "COL",
+ "COM",
+ "MYT",
+ "COG",
+ "COD",
+ "COK",
+ "CRI",
+ "HRV",
+ "CUB",
+ "CYP",
+ "CZE",
+ "BEN",
+ "DNK",
+ "DMA",
+ "DOM",
+ "ECU",
+ "SLV",
+ "GNQ",
+ "ETH",
+ "ERI",
+ "EST",
+ "FRO",
+ "FLK",
+ "SGS",
+ "FJI",
+ "FIN",
+ "ALA",
+ "FRA",
+ "GUF",
+ "PYF",
+ "ATF",
+ "DJI",
+ "GAB",
+ "GEO",
+ "GMB",
+ "PSE",
+ "DEU",
+ "GHA",
+ "GIB",
+ "KIR",
+ "GRC",
+ "GRL",
+ "GRD",
+ "GLP",
+ "GUM",
+ "GTM",
+ "GIN",
+ "GUY",
+ "HTI",
+ "HMD",
+ "VAT",
+ "HND",
+ "HKG",
+ "HUN",
+ "ISL",
+ "IND",
+ "IDN",
+ "IRN",
+ "IRQ",
+ "IRL",
+ "ISR",
+ "ITA",
+ "CIV",
+ "JAM",
+ "JPN",
+ "KAZ",
+ "JOR",
+ "KEN",
+ "PRK",
+ "KOR",
+ "KWT",
+ "KGZ",
+ "LAO",
+ "LBN",
+ "LSO",
+ "LVA",
+ "LBR",
+ "LBY",
+ "LIE",
+ "LTU",
+ "LUX",
+ "MAC",
+ "MDG",
+ "MWI",
+ "MYS",
+ "MDV",
+ "MLI",
+ "MLT",
+ "MTQ",
+ "MRT",
+ "MUS",
+ "MEX",
+ "MCO",
+ "MNG",
+ "MDA",
+ "MNE",
+ "MSR",
+ "MAR",
+ "MOZ",
+ "OMN",
+ "NAM",
+ "NRU",
+ "NPL",
+ "NLD",
+ "ANT",
+ "CUW",
+ "ABW",
+ "SXM",
+ "BES",
+ "NCL",
+ "VUT",
+ "NZL",
+ "NIC",
+ "NER",
+ "NGA",
+ "NIU",
+ "NFK",
+ "NOR",
+ "MNP",
+ "UMI",
+ "FSM",
+ "MHL",
+ "PLW",
+ "PAK",
+ "PAN",
+ "PNG",
+ "PRY",
+ "PER",
+ "PHL",
+ "PCN",
+ "POL",
+ "PRT",
+ "GNB",
+ "TLS",
+ "PRI",
+ "QAT",
+ "REU",
+ "ROU",
+ "RUS",
+ "RWA",
+ "BLM",
+ "SHN",
+ "KNA",
+ "AIA",
+ "LCA",
+ "MAF",
+ "SPM",
+ "VCT",
+ "SMR",
+ "STP",
+ "SAU",
+ "SEN",
+ "SRB",
+ "SYC",
+ "SLE",
+ "SGP",
+ "SVK",
+ "VNM",
+ "SVN",
+ "SOM",
+ "ZAF",
+ "ZWE",
+ "ESP",
+ "SSD",
+ "ESH",
+ "SDN",
+ "SUR",
+ "SJM",
+ "SWZ",
+ "SWE",
+ "CHE",
+ "SYR",
+ "TJK",
+ "THA",
+ "TGO",
+ "TKL",
+ "TON",
+ "TTO",
+ "ARE",
+ "TUN",
+ "TUR",
+ "TKM",
+ "TCA",
+ "TUV",
+ "UGA",
+ "UKR",
+ "MKD",
+ "EGY",
+ "GBR",
+ "GGY",
+ "JEY",
+ "IMN",
+ "TZA",
+ "USA",
+ "VIR",
+ "BFA",
+ "URY",
+ "UZB",
+ "VEN",
+ "WLF",
+ "WSM",
+ "YEM",
+ "ZMB"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "continent": {
+ "description": "continent name",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "AF",
+ "AN",
+ "AS",
+ "EU",
+ "NA",
+ "OC",
+ "SA"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "country"
+ ]
+ },
+ {
+ "required": [
+ "continent"
+ ]
+ }
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for Geolocation 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": {
+ "country": {
+ "optionType": "global",
+ "value": "DZA"
+ },
+ "continent": {
+ "optionType": "global",
+ "value": "AF"
+ }
+ }
+ },
+ "name": "GeolocationParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_identity.json b/gen/models/profile_parcels/policy_object_security_identity.json
new file mode 100644
index 00000000..d98e86eb
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_identity.json
@@ -0,0 +1,146 @@
+{
+ "request": {
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-identity/post/request_schema.json",
+ "title": "security-identity Parcel Schema",
+ "description": "security-identity profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Array of Users and User Groups",
+ "type": "array",
+ "maxItems": 16,
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "user": {
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "description": "Mustn't contain non standard unicode characters",
+ "pattern": "^.*[a-zA-Z0-9]+.*$",
+ "minLength": 1,
+ "maxLength": 64
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "userGroup": {
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "description": "Mustn't contain non standard unicode characters",
+ "pattern": "^.*[a-zA-Z0-9]+.*$",
+ "maxLength": 96,
+ "minLength": 1
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "user"
+ ]
+ },
+ {
+ "required": [
+ "userGroup"
+ ]
+ }
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-identity 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": [
+ {
+ "user": {
+ "optionType": "global",
+ "value": "administrator"
+ }
+ },
+ {
+ "userGroup": {
+ "optionType": "global",
+ "value": "SDWAN-IDENTITY.CISCO.COM/Users/Domain Guests"
+ }
+ }
+ ]
+ },
+ "name": "testIdentityList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_ipssignature.json b/gen/models/profile_parcels/policy_object_security_ipssignature.json
new file mode 100644
index 00000000..15985616
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_ipssignature.json
@@ -0,0 +1,131 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-ipssignature/post/request_schema.json",
+ "title": "security-ipssignature Parcel Schema",
+ "description": "security-ipssignature profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Ips Signature",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "generatorId": {
+ "description": "",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "^(429496729[0-5]|42949672[0-8]\\d|4294967[01]\\d{2}|429496[0-6]\\d{3}|42949[0-5]\\d{4}|4294[0-8]\\d{5}|429[0-3]\\d{6}|42[0-8]\\d{7}|4[01]\\d{8}|[1-3]\\d{9}|[1-9]\\d{8}|[1-9]\\d{7}|[1-9]\\d{6}|[1-9]\\d{5}|[1-9]\\d{4}|[1-9]\\d{3}|[1-9]\\d{2}|[1-9]\\d|\\d)$"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "signatureId": {
+ "description": "",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "^(429496729[0-5]|42949672[0-8]\\d|4294967[01]\\d{2}|429496[0-6]\\d{3}|42949[0-5]\\d{4}|4294[0-8]\\d{5}|429[0-3]\\d{6}|42[0-8]\\d{7}|4[01]\\d{8}|[1-3]\\d{9}|[1-9]\\d{8}|[1-9]\\d{7}|[1-9]\\d{6}|[1-9]\\d{5}|[1-9]\\d{4}|[1-9]\\d{3}|[1-9]\\d{2}|[1-9]\\d|\\d)$"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "generatorId",
+ "signatureId"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-ipssignature 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": [
+ {
+ "generatorId": {
+ "optionType": "global",
+ "value": "1234"
+ },
+ "signatureId": {
+ "optionType": "global",
+ "value": "5678"
+ }
+ }
+ ]
+ },
+ "name": "security-ipssignatureParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_localapp.json b/gen/models/profile_parcels/policy_object_security_localapp.json
new file mode 100644
index 00000000..4b96fb3b
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_localapp.json
@@ -0,0 +1,139 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-localapp/post/request_schema.json",
+ "title": "security-localapp Parcel Schema",
+ "description": "security-localapp profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Localapp list",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "app": {
+ "description": "",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "appFamily": {
+ "description": "",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "oneOf": [
+ {
+ "required": [
+ "app"
+ ]
+ },
+ {
+ "required": [
+ "appFamily"
+ ]
+ }
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-localapp 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": [
+ {
+ "app": {
+ "optionType": "global",
+ "value": "audible-com"
+ }
+ },
+ {
+ "appFamily": {
+ "optionType": "global",
+ "value": "web"
+ }
+ }
+ ]
+ },
+ "name": "security-localappParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_localdomain.json b/gen/models/profile_parcels/policy_object_security_localdomain.json
new file mode 100644
index 00000000..3cd73fb4
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_localdomain.json
@@ -0,0 +1,108 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-localdomain/post/request_schema.json",
+ "title": "security-localdomain Parcel Schema",
+ "description": "security-localdomain profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "type": "array",
+ "maxItems": 64,
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "nameServer": {
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 240,
+ "description": "Must be valid utd regex. String cannot start with a '*' or a '+', be empty, or be more than 240 characters",
+ "pattern": "^[^*+].*"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "nameServer"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-localdomain 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": [
+ {
+ "nameServer": {
+ "optionType": "global",
+ "value": "hello.com"
+ }
+ },
+ {
+ "nameServer": {
+ "optionType": "global",
+ "value": ".*cisco.com"
+ }
+ }
+ ]
+ },
+ "name": "security-localdomainParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_port.json b/gen/models/profile_parcels/policy_object_security_port.json
new file mode 100644
index 00000000..929f800b
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_port.json
@@ -0,0 +1,118 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-port/post/request_schema.json",
+ "title": "Port Parcel Schema",
+ "description": "Port profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Port List",
+ "type": "array",
+ "maxItems": 64,
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "port": {
+ "description": "can be single port or port range",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "oneOf": [
+ {
+ "type": "string",
+ "pattern": "^(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"
+ },
+ {
+ "type": "string",
+ "pattern": "^(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])\\-(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$"
+ }
+ ]
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "port"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for Port 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": [
+ {
+ "port": {
+ "optionType": "global",
+ "value": "100"
+ }
+ },
+ {
+ "port": {
+ "optionType": "global",
+ "value": "200"
+ }
+ },
+ {
+ "port": {
+ "optionType": "global",
+ "value": "300-400"
+ }
+ }
+ ]
+ },
+ "name": "PortList"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_protocolname.json b/gen/models/profile_parcels/policy_object_security_protocolname.json
new file mode 100644
index 00000000..dfb6f253
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_protocolname.json
@@ -0,0 +1,268 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-protocolname/post/request_schema.json",
+ "title": "security-protocolname Parcel Schema",
+ "description": "security-protocolname profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "type": "array",
+ "maxItems": 64,
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "protocolName": {
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "snmp",
+ "icmp",
+ "tcp",
+ "udp",
+ "echo",
+ "telnet",
+ "wins",
+ "n2h2server",
+ "nntp",
+ "pptp",
+ "rtsp",
+ "bootpc",
+ "gdoi",
+ "tacacs",
+ "gopher",
+ "icabrowser",
+ "skinny",
+ "sunrpc",
+ "biff",
+ "router",
+ "ircs",
+ "orasrv",
+ "ms-cluster-net",
+ "kermit",
+ "isakmp",
+ "sshell",
+ "realsecure",
+ "ircu",
+ "appleqtc",
+ "pwdgen",
+ "rdb-dbs-disp",
+ "creativepartnr",
+ "finger",
+ "ftps",
+ "giop",
+ "rsvd",
+ "hp-alarm-mgr",
+ "uucp",
+ "kerberos",
+ "imap",
+ "time",
+ "bootps",
+ "tftp",
+ "oracle",
+ "snmptrap",
+ "http",
+ "qmtp",
+ "radius",
+ "oracle-em-vp",
+ "tarantella",
+ "pcanywheredata",
+ "ldap",
+ "mgcp",
+ "sqlsrv",
+ "hsrp",
+ "cisco-net-mgmt",
+ "smtp",
+ "pcanywherestat",
+ "exec",
+ "send",
+ "stun",
+ "syslog",
+ "ms-sql-m",
+ "citrix",
+ "creativeserver",
+ "cifs",
+ "cisco-sys",
+ "cisco-tna",
+ "ms-dotnetster",
+ "gtpv1",
+ "gtpv0",
+ "imap3",
+ "fcip-port",
+ "netbios-dgm",
+ "sip-tls",
+ "pop3s",
+ "cisco-fna",
+ "802-11-iapp",
+ "oem-agent",
+ "cisco-tdp",
+ "tr-rsrb",
+ "r-winsock",
+ "sql-net",
+ "syslog-conn",
+ "tacacs-ds",
+ "h225ras",
+ "ace-svr",
+ "dhcp-failover",
+ "igmpv3lite",
+ "irc-serv",
+ "entrust-svcs",
+ "dbcontrol_agent",
+ "cisco-svcs",
+ "ipsec-msft",
+ "microsoft-ds",
+ "ms-sna",
+ "rsvp_tunnel",
+ "rsvp-encap",
+ "hp-collector",
+ "netbios-ns",
+ "msexch-routing",
+ "h323",
+ "l2tp",
+ "ldap-admin",
+ "pop3",
+ "h323callsigalt",
+ "ms-sql",
+ "iscsi-target",
+ "webster",
+ "lotusnote",
+ "ipx",
+ "entrust-svc-hand",
+ "citriximaclient",
+ "rtc-pm-port",
+ "ftp",
+ "aol",
+ "xdmcp",
+ "oraclenames",
+ "login",
+ "iscsi",
+ "ttc",
+ "imaps",
+ "socks",
+ "ssh",
+ "dnsix",
+ "daytime",
+ "sip",
+ "discard",
+ "ntp",
+ "ldaps",
+ "https",
+ "vdolive",
+ "ica",
+ "net8-cman",
+ "cuseeme",
+ "netstat",
+ "sms",
+ "streamworks",
+ "rtelnet",
+ "who",
+ "kazaa",
+ "ssp",
+ "dbase",
+ "timed",
+ "cddbp",
+ "telnets",
+ "ymsgr",
+ "ident",
+ "bgp",
+ "ddns-v3",
+ "vqp",
+ "irc",
+ "ipass",
+ "x11",
+ "dns",
+ "lotusmtap",
+ "mysql",
+ "nfs",
+ "msnmsgr",
+ "netshow",
+ "sqlserv",
+ "hp-managed-node",
+ "ncp",
+ "shell",
+ "realmedia",
+ "msrpc",
+ "clp"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "protocolName"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-protocolname 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": [
+ {
+ "protocolName": {
+ "optionType": "global",
+ "value": "aol"
+ }
+ }
+ ]
+ },
+ "name": "security-protocolnameParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_scalablegrouptag.json b/gen/models/profile_parcels/policy_object_security_scalablegrouptag.json
new file mode 100644
index 00000000..aa1767ce
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_scalablegrouptag.json
@@ -0,0 +1,131 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-scalablegrouptag/post/request_schema.json",
+ "title": "security-scalablegrouptag Parcel Schema",
+ "description": "security-scalablegrouptag profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "type": "array",
+ "maxItems": 8,
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "sgtName": {
+ "description": "",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "minLength": 1
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "tag": {
+ "description": "",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "minLength": 1
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "sgtName",
+ "tag"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-scalablegrouptag 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": [
+ {
+ "sgtName": {
+ "optionType": "global",
+ "value": "ANY"
+ },
+ "tag": {
+ "optionType": "global",
+ "value": "65535"
+ }
+ }
+ ]
+ },
+ "name": "security-scalablegrouptagParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
diff --git a/gen/models/profile_parcels/policy_object_security_urllist.json b/gen/models/profile_parcels/policy_object_security_urllist.json
new file mode 100644
index 00000000..f1ef9da4
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_urllist.json
@@ -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
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_security_zone.json b/gen/models/profile_parcels/policy_object_security_zone.json
new file mode 100644
index 00000000..5e10984b
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_security_zone.json
@@ -0,0 +1,145 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/security-zone/post/request_schema.json",
+ "title": "security-zone Parcel Schema",
+ "description": "security-zone profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "minLength": 1,
+ "maxLength": 32,
+ "pattern": "(?i)^(?:(?!\\b(untrusted|self|default|service)\\b).)*$"
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "minItems": 1,
+ "oneOf": [
+ {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "vpn": {
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "vpn"
+ ],
+ "additionalProperties": false
+ }
+ },
+ {
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "interface": {
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "interface"
+ ],
+ "additionalProperties": false
+ }
+ }
+ ]
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for security-zone 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": [
+ {
+ "vpn": {
+ "optionType": "global",
+ "value": "Guest"
+ }
+ }
+ ]
+ },
+ "name": "zoneList1"
+ },
+ {
+ "data": {
+ "entries": [
+ {
+ "interface": {
+ "optionType": "global",
+ "value": "GigabitEthernet1"
+ }
+ }
+ ]
+ },
+ "name": "zoneList2"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_sla_class.json b/gen/models/profile_parcels/policy_object_sla_class.json
new file mode 100644
index 00000000..cd607cb7
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_sla_class.json
@@ -0,0 +1,184 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/post/request_schema.json",
+ "title": "Sla class Parcel Schema",
+ "description": "Sla class profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "Sla class List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "latency": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesLatencyOptionsDef"
+ },
+ "loss": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesLossOptionsDef"
+ },
+ "jitter": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesJitterOptionsDef"
+ },
+ "appProbeClass": {
+ "description": "App Probe Class Ref",
+ "type": "object",
+ "properties": {
+ "refId": {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string",
+ "pattern": "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "refId"
+ ],
+ "additionalProperties": false
+ },
+ "fallbackBestTunnel": {
+ "description": "Object with a criteria and variance",
+ "type": "object",
+ "properties": {
+ "criteria": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesCriteriaOptionsDef"
+ },
+ "lossVariance": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesLossOptionsDef"
+ },
+ "latencyVariance": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesLatencyOptionsDef"
+ },
+ "jitterVariance": {
+ "description": "",
+ "type": "object",
+ "$ref": "#/$defs/oneOfEntriesJitterOptionsDef"
+ }
+ }
+ }
+ },
+ "anyOf": [
+ {
+ "required": [
+ "latency"
+ ]
+ },
+ {
+ "required": [
+ "loss"
+ ]
+ },
+ {
+ "required": [
+ "jitter"
+ ]
+ }
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for Sla class 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": [
+ {
+ "latency": {
+ "optionType": "global",
+ "value": 2
+ },
+ "loss": {
+ "optionType": "global",
+ "value": 1
+ },
+ "jitter": {
+ "optionType": "global",
+ "value": 3
+ },
+ "appProbeClass": {
+ "refId": {
+ "optionType": "global",
+ "value": "b61d994e-7f6d-4ba0-a061-3a87cd32219a"
+ }
+ },
+ "fallbackBestTunnel": {
+ "criteria": {
+ "optionType": "global",
+ "value": "loss"
+ },
+ "lossVariance": {
+ "optionType": "global",
+ "value": 5
+ }
+ }
+ }
+ ]
+ },
+ "name": "centralized-slaclassParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_standard_community.json b/gen/models/profile_parcels/policy_object_standard_community.json
new file mode 100644
index 00000000..20b00a80
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_standard_community.json
@@ -0,0 +1,119 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/standard-community/common/request_schema.json",
+ "title": "Standard Community List Parcel Schema",
+ "description": "standard Community list profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 32
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "oneOf": [
+ {
+ "description": "Standard Community List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "properties": {
+ "standardCommunity": {
+ "type": "object",
+ "description": "Standard Community",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "oneOf": [
+ {
+ "enum": [
+ "internet",
+ "local-AS",
+ "no-advertise",
+ "no-export"
+ ],
+ "type": "string"
+ },
+ {
+ "type": "string",
+ "pattern": "^(0|[1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5]):(0|[1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$"
+ }
+ ]
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "standardCommunity"
+ ],
+ "additionalProperties": false
+ }
+ }
+ ]
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for standard community 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": [
+ {
+ "standardCommunity": {
+ "optionType": "global",
+ "value": "1000:10000"
+ }
+ },
+ {
+ "standardCommunity": {
+ "optionType": "global",
+ "value": "internet"
+ }
+ }
+ ]
+ },
+ "name": "standardCommunityList1"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_tloc_list.json b/gen/models/profile_parcels/policy_object_tloc_list.json
new file mode 100644
index 00000000..df9f2dd6
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_tloc_list.json
@@ -0,0 +1,212 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/tloc/post/request_schema.json",
+ "title": "tloc Parcel Schema",
+ "description": "tloc profile parcel schema for POST request",
+ "type": "object",
+ "properties": {
+ "name": {
+ "minLength": 1,
+ "maxLength": 32,
+ "pattern": "^[^&<>! \"]+$",
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "TLOC List",
+ "type": "array",
+ "minItems": 1,
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "tloc": {
+ "description": "tloc",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "color": {
+ "description": "color",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "3g",
+ "biz-internet",
+ "blue",
+ "bronze",
+ "custom1",
+ "custom2",
+ "custom3",
+ "default",
+ "gold",
+ "green",
+ "lte",
+ "metro-ethernet",
+ "mpls",
+ "private1",
+ "private2",
+ "private3",
+ "private4",
+ "private5",
+ "private6",
+ "public-internet",
+ "red",
+ "silver"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "encap": {
+ "description": "encapsulation",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "enum": [
+ "ipsec",
+ "gre"
+ ],
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "preference": {
+ "description": "Preference",
+ "type": "object",
+ "oneOf": [
+ {
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "type": "string"
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ ]
+ }
+ },
+ "required": [
+ "tloc",
+ "color",
+ "encap"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for POST request schema for tloc 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": [
+ {
+ "tloc": {
+ "optionType": "global",
+ "value": "10.0.0.0"
+ },
+ "color": {
+ "optionType": "global",
+ "value": "3g"
+ },
+ "encap": {
+ "optionType": "global",
+ "value": "gre"
+ },
+ "preference": {
+ "optionType": "global",
+ "value": "33"
+ }
+ }
+ ]
+ },
+ "name": "tlocParcelGlobalDefault"
+ }
+ ]
+ }
+ },
+ "required": [
+ "data",
+ "name"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/models/profile_parcels/policy_object_vpn_group.json b/gen/models/profile_parcels/policy_object_vpn_group.json
new file mode 100644
index 00000000..19dc0783
--- /dev/null
+++ b/gen/models/profile_parcels/policy_object_vpn_group.json
@@ -0,0 +1,117 @@
+{
+ "request": {
+ "$schema": "http://json-schema.org/draft/2019-09/schema",
+ "$id": "https://cisco.com/schema/profileparcel/sdwan/policy-object/vpn-group/common/request_schema.json",
+ "title": "VPN List Parcel Schema",
+ "description": "vpn list profile parcel schema",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[^&<>! \"]+$",
+ "minLength": 1,
+ "maxLength": 128
+ },
+ "description": {
+ "type": "string"
+ },
+ "data": {
+ "type": "object",
+ "properties": {
+ "entries": {
+ "description": "VPN List",
+ "type": "array",
+ "uniqueItems": true,
+ "items": {
+ "type": "object",
+ "properties": {
+ "vpn": {
+ "description": "can be single vpn id or vpn id range",
+ "type": "object",
+ "properties": {
+ "optionType": {
+ "type": "string",
+ "enum": [
+ "global"
+ ]
+ },
+ "value": {
+ "oneOf": [
+ {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 65530
+ },
+ {
+ "type": "string",
+ "pattern": "^(0|[1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|65530)\\-(0|[1-9]\\d{0,3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|65530)$"
+ }
+ ]
+ }
+ },
+ "required": [
+ "optionType",
+ "value"
+ ],
+ "additionalProperties": false
+ }
+ },
+ "required": [
+ "vpn"
+ ],
+ "additionalProperties": false
+ }
+ }
+ },
+ "required": [
+ "entries"
+ ],
+ "additionalProperties": false
+ },
+ "documentation": {
+ "description": "This is the documentation for vpn 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": [
+ {
+ "vpn": {
+ "optionType": "global",
+ "value": 100
+ }
+ },
+ {
+ "vpn": {
+ "optionType": "global",
+ "value": 200
+ }
+ },
+ {
+ "vpn": {
+ "optionType": "global",
+ "value": "300-400"
+ }
+ }
+ ]
+ },
+ "name": "vpnList1"
+ }
+ ]
+ }
+ },
+ "required": [
+ "name",
+ "data"
+ ],
+ "not": {
+ "required": [
+ "documentation"
+ ]
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/gen/templates/profile_parcels/resource_test.go b/gen/templates/profile_parcels/resource_test.go
index 8a271475..2f2f40c5 100644
--- a/gen/templates/profile_parcels/resource_test.go
+++ b/gen/templates/profile_parcels/resource_test.go
@@ -140,6 +140,71 @@ const testAccSdwan{{camelCase .Name}}PrerequisitesProfileParcelConfig = `
config += ` description = "Terraform integration test"` + "\n"
{{- range .Attributes}}
{{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}}
+ {{- if isNestedListSet .}}
+ {{- if len .TestTags}}
+ if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
+ {{- end}}
+ config += ` {{.TfName}} = [{` + "\n"
+ {{- range .Attributes}}
+ {{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}}
+ {{- if isNestedListSet .}}
+ {{- if len .TestTags}}
+ if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
+ {{- end}}
+ config += ` {{.TfName}} = [{` + "\n"
+ {{- range .Attributes}}
+ {{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}}
+ {{- if isNestedListSet .}}
+ {{- if len .TestTags}}
+ if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
+ {{- end}}
+ config += ` {{.TfName}} = [{` + "\n"
+ {{- range .Attributes}}
+ {{- if and (or .Reference .Mandatory .MinimumTestValue) (not .Optional)}}
+ {{- if len .TestTags}}
+ if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
+ config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n"
+ }
+ {{- else}}
+ config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n"
+ {{- end}}
+ {{- end}}
+ {{- end}}
+ config += ` }]` + "\n"
+ {{- if len .TestTags}}
+ }
+ {{- end}}
+ {{- else}}
+ {{- if len .TestTags}}
+ if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
+ config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n"
+ }
+ {{- else}}
+ config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n"
+ {{- end}}
+ {{- end}}
+ {{- end}}
+ {{- end}}
+ config += ` }]` + "\n"
+ {{- if len .TestTags}}
+ }
+ {{- end}}
+ {{- else}}
+ {{- if len .TestTags}}
+ if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
+ config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n"
+ }
+ {{- else}}
+ config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n"
+ {{- end}}
+ {{- end}}
+ {{- end}}
+ {{- end}}
+ config += ` }]` + "\n"
+ {{- if len .TestTags}}
+ }
+ {{- end}}
+ {{- else}}
{{- if len .TestTags}}
if {{range $i, $e := .TestTags}}{{if $i}} || {{end}}os.Getenv("{{$e}}") != ""{{end}} {
config += ` {{.TfName}} = {{if .MinimumTestValue}}{{.MinimumTestValue}}{{else if .TestValue}}{{.TestValue}}{{else}}{{if eq .Type "String"}}"{{.Example}}"{{else if isStringListSet .}}["{{.Example}}"]{{else if isInt64ListSet .}}[{{.Example}}]{{else}}{{.Example}}{{end}}{{end}}` + "\n"
@@ -149,6 +214,7 @@ const testAccSdwan{{camelCase .Name}}PrerequisitesProfileParcelConfig = `
{{- end}}
{{- end}}
{{- end}}
+ {{- end}}
config += `}` + "\n"
return config
}{{end}}
diff --git a/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel.go
new file mode 100644
index 00000000..82fd77d3
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel.go
@@ -0,0 +1,133 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectClassMapProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectClassMapProfileParcelDataSource{}
+)
+
+func NewPolicyObjectClassMapProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectClassMapProfileParcelDataSource{}
+}
+
+type PolicyObjectClassMapProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectClassMapProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_class_map_profile_parcel"
+}
+
+func (d *PolicyObjectClassMapProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Class Map profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "class map List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "queue": schema.StringAttribute{
+ MarkdownDescription: "select a queue",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectClassMapProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectClassMapProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectClassMap
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel_test.go
new file mode 100644
index 00000000..1a7482b6
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_class_map_profile_parcel_test.go
@@ -0,0 +1,78 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectClassMapProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_class_map_profile_parcel.test", "entries.0.queue", "0"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectClassMapProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectClassMapProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_class_map_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` queue = "0"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_class_map_profile_parcel" "test" {
+ id = sdwan_policy_object_class_map_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_color_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_color_list_profile_parcel.go
new file mode 100644
index 00000000..197b23a5
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_color_list_profile_parcel.go
@@ -0,0 +1,133 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectColorListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectColorListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectColorListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectColorListProfileParcelDataSource{}
+}
+
+type PolicyObjectColorListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectColorListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_color_list_profile_parcel"
+}
+
+func (d *PolicyObjectColorListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Color List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "Color List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "color": schema.StringAttribute{
+ MarkdownDescription: "",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectColorListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectColorListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectColorList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_color_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_color_list_profile_parcel_test.go
new file mode 100644
index 00000000..46421a8b
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_color_list_profile_parcel_test.go
@@ -0,0 +1,78 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectColorListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_color_list_profile_parcel.test", "entries.0.color", "blue"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectColorListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectColorListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectColorListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectColorListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_color_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` color = "blue"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_color_list_profile_parcel" "test" {
+ id = sdwan_policy_object_color_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_color_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_color_profile_parcel.go
new file mode 100644
index 00000000..2794a49e
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_color_profile_parcel.go
@@ -0,0 +1,133 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectColorProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectColorProfileParcelDataSource{}
+)
+
+func NewPolicyObjectColorProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectColorProfileParcelDataSource{}
+}
+
+type PolicyObjectColorProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectColorProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_color_profile_parcel"
+}
+
+func (d *PolicyObjectColorProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Color profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "Color List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "color": schema.StringAttribute{
+ MarkdownDescription: "",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectColorProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectColorProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectColor
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_color_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_color_profile_parcel_test.go
new file mode 100644
index 00000000..00670858
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_color_profile_parcel_test.go
@@ -0,0 +1,74 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectColorProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_color_profile_parcel.test", "entries.0.color", "blue"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectColorProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectColorProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_color_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` color = "blue"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_color_profile_parcel" "test" {
+ id = sdwan_policy_object_color_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..6ec084b7
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go
@@ -0,0 +1,137 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectDataIPv4PrefixListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectDataIPv4PrefixListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectDataIPv4PrefixListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectDataIPv4PrefixListProfileParcelDataSource{}
+}
+
+type PolicyObjectDataIPv4PrefixListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectDataIPv4PrefixListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_ipv4_prefix_list_profile_parcel"
+}
+
+func (d *PolicyObjectDataIPv4PrefixListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Data IPv4 Prefix List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv4 Data Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: "IPv4 address",
+ Computed: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix Length",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectDataIPv4PrefixListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectDataIPv4PrefixListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectDataIPv4PrefixList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..2ef68406
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel_test.go
@@ -0,0 +1,80 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectDataIPv4PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectDataIPv4PrefixListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectDataIPv4PrefixListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectDataIPv4PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectDataIPv4PrefixListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel" "test" {
+ id = sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..e7b4b788
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go
@@ -0,0 +1,137 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectDataIPv6PrefixListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectDataIPv6PrefixListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectDataIPv6PrefixListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectDataIPv6PrefixListProfileParcelDataSource{}
+}
+
+type PolicyObjectDataIPv6PrefixListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectDataIPv6PrefixListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_ipv6_prefix_list_profile_parcel"
+}
+
+func (d *PolicyObjectDataIPv6PrefixListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Data IPv6 Prefix List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv6 Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: "IPv6 address",
+ Computed: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectDataIPv6PrefixListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectDataIPv6PrefixListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectDataIPv6PrefixList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..36868ea5
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel_test.go
@@ -0,0 +1,81 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectDataIPv6PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectDataIPv6PrefixListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectDataIPv6PrefixListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectDataIPv6PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectDataIPv6PrefixListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel" "test" {
+ id = sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go
new file mode 100644
index 00000000..9930ce45
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go
@@ -0,0 +1,137 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectDataIPv6PrefixProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectDataIPv6PrefixProfileParcelDataSource{}
+)
+
+func NewPolicyObjectDataIPv6PrefixProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectDataIPv6PrefixProfileParcelDataSource{}
+}
+
+type PolicyObjectDataIPv6PrefixProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectDataIPv6PrefixProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_ipv6_prefix_profile_parcel"
+}
+
+func (d *PolicyObjectDataIPv6PrefixProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Data IPv6 Prefix profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv6 Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: "IPv6 address",
+ Computed: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectDataIPv6PrefixProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectDataIPv6PrefixProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectDataIPv6Prefix
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..5debbff9
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go
@@ -0,0 +1,76 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" {
+ id = sdwan_policy_object_data_ipv6_prefix_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel.go
new file mode 100644
index 00000000..00748450
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel.go
@@ -0,0 +1,137 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectDataPrefixProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectDataPrefixProfileParcelDataSource{}
+)
+
+func NewPolicyObjectDataPrefixProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectDataPrefixProfileParcelDataSource{}
+}
+
+type PolicyObjectDataPrefixProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectDataPrefixProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_prefix_profile_parcel"
+}
+
+func (d *PolicyObjectDataPrefixProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Data Prefix profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv4 Data Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: "IPv4 address",
+ Computed: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix Length",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectDataPrefixProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectDataPrefixProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectDataPrefix
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..cb658e87
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_data_prefix_profile_parcel_test.go
@@ -0,0 +1,76 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_data_prefix_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectDataPrefixProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectDataPrefixProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_data_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_data_prefix_profile_parcel" "test" {
+ id = sdwan_policy_object_data_prefix_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_expanded_community_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_expanded_community_list_profile_parcel.go
new file mode 100644
index 00000000..a7639fb2
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_expanded_community_list_profile_parcel.go
@@ -0,0 +1,132 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectExpandedCommunityListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectExpandedCommunityListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectExpandedCommunityListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectExpandedCommunityListProfileParcelDataSource{}
+}
+
+type PolicyObjectExpandedCommunityListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectExpandedCommunityListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_expanded_community_list_profile_parcel"
+}
+
+func (d *PolicyObjectExpandedCommunityListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Expanded Community List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "expanded_community_lists": schema.SetAttribute{
+ MarkdownDescription: "Expanded Community List",
+ ElementType: types.StringType,
+ Computed: true,
+ },
+ "expanded_community_lists_variable": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
+ Computed: true,
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectExpandedCommunityListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectExpandedCommunityListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectExpandedCommunityList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_expanded_community_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_expanded_community_list_profile_parcel_test.go
new file mode 100644
index 00000000..d4aad26b
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_expanded_community_list_profile_parcel_test.go
@@ -0,0 +1,76 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectExpandedCommunityListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectExpandedCommunityListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectExpandedCommunityListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectExpandedCommunityListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectExpandedCommunityListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_expanded_community_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` expanded_community_lists = ["abcd"]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_expanded_community_list_profile_parcel" "test" {
+ id = sdwan_policy_object_expanded_community_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel.go
new file mode 100644
index 00000000..1709f234
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel.go
@@ -0,0 +1,132 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectExpandedCommunityProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectExpandedCommunityProfileParcelDataSource{}
+)
+
+func NewPolicyObjectExpandedCommunityProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectExpandedCommunityProfileParcelDataSource{}
+}
+
+type PolicyObjectExpandedCommunityProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectExpandedCommunityProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_expanded_community_profile_parcel"
+}
+
+func (d *PolicyObjectExpandedCommunityProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Expanded Community profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "expanded_community_lists": schema.SetAttribute{
+ MarkdownDescription: "Expanded Community List",
+ ElementType: types.StringType,
+ Computed: true,
+ },
+ "expanded_community_lists_variable": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
+ Computed: true,
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectExpandedCommunityProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectExpandedCommunityProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectExpandedCommunity
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel_test.go
new file mode 100644
index 00000000..8a4c86b9
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_expanded_community_profile_parcel_test.go
@@ -0,0 +1,71 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectExpandedCommunityProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_expanded_community_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` expanded_community_lists = ["abcd"]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_expanded_community_profile_parcel" "test" {
+ id = sdwan_policy_object_expanded_community_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_extended_community_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_extended_community_list_profile_parcel.go
new file mode 100644
index 00000000..b3a6e2de
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_extended_community_list_profile_parcel.go
@@ -0,0 +1,133 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectExtendedCommunityListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectExtendedCommunityListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectExtendedCommunityListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectExtendedCommunityListProfileParcelDataSource{}
+}
+
+type PolicyObjectExtendedCommunityListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectExtendedCommunityListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_extended_community_list_profile_parcel"
+}
+
+func (d *PolicyObjectExtendedCommunityListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Extended Community List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "Extended Community List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "extended_community": schema.StringAttribute{
+ MarkdownDescription: "can be soo 10.0.0.1:30 or rt 500:50 etc.",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectExtendedCommunityListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectExtendedCommunityListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectExtendedCommunityList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_extended_community_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_extended_community_list_profile_parcel_test.go
new file mode 100644
index 00000000..1cc84144
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_extended_community_list_profile_parcel_test.go
@@ -0,0 +1,79 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectExtendedCommunityListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_extended_community_list_profile_parcel.test", "entries.0.extended_community", "soo 10.0.0.1:30"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectExtendedCommunityListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectExtendedCommunityListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectExtendedCommunityListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectExtendedCommunityListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_extended_community_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` extended_community = "soo 10.0.0.1:30"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_extended_community_list_profile_parcel" "test" {
+ id = sdwan_policy_object_extended_community_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel.go
new file mode 100644
index 00000000..3af55f34
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel.go
@@ -0,0 +1,133 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectExtendedCommunityProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectExtendedCommunityProfileParcelDataSource{}
+)
+
+func NewPolicyObjectExtendedCommunityProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectExtendedCommunityProfileParcelDataSource{}
+}
+
+type PolicyObjectExtendedCommunityProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectExtendedCommunityProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_extended_community_profile_parcel"
+}
+
+func (d *PolicyObjectExtendedCommunityProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Extended Community profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "Extended Community List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "extended_community": schema.StringAttribute{
+ MarkdownDescription: "can be soo 10.0.0.1:30 or rt 500:50 etc.",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectExtendedCommunityProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectExtendedCommunityProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectExtendedCommunity
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel_test.go
new file mode 100644
index 00000000..67fe7313
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_extended_community_profile_parcel_test.go
@@ -0,0 +1,74 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_extended_community_profile_parcel.test", "entries.0.extended_community", "soo 10.0.0.1:30"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectExtendedCommunityProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_extended_community_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` extended_community = "soo 10.0.0.1:30"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_extended_community_profile_parcel" "test" {
+ id = sdwan_policy_object_extended_community_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_feature_profile.go b/internal/provider/data_source_sdwan_policy_object_feature_profile.go
new file mode 100644
index 00000000..2ee7d13a
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_feature_profile.go
@@ -0,0 +1,113 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectFeatureProfileDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectFeatureProfileDataSource{}
+)
+
+func NewPolicyObjectFeatureProfileDataSource() datasource.DataSource {
+ return &PolicyObjectFeatureProfileDataSource{}
+}
+
+type PolicyObjectFeatureProfileDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectFeatureProfileDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_feature_profile"
+}
+
+func (d *PolicyObjectFeatureProfileDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Feature Profile .",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the object",
+ Required: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the policy object feature profile",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "Description",
+ Computed: true,
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectFeatureProfileDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectFeatureProfileDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectFeatureProfile
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Id.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_feature_profile_test.go b/internal/provider/data_source_sdwan_policy_object_feature_profile_test.go
new file mode 100644
index 00000000..1497a2a2
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_feature_profile_test.go
@@ -0,0 +1,71 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectFeatureProfile(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_feature_profile.test", "name", "POLICY_OBJECT_FP_1"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_feature_profile.test", "description", "My policy object feature profile 1"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectFeatureProfileConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectFeatureProfileConfig() string {
+ config := ""
+ config += `resource "sdwan_policy_object_feature_profile" "test" {` + "\n"
+ config += ` name = "POLICY_OBJECT_FP_1"` + "\n"
+ config += ` description = "My policy object feature profile 1"` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_feature_profile" "test" {
+ id = sdwan_policy_object_feature_profile.test.id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..bf100acf
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go
@@ -0,0 +1,145 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectIPv4PrefixListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectIPv4PrefixListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectIPv4PrefixListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectIPv4PrefixListProfileParcelDataSource{}
+}
+
+type PolicyObjectIPv4PrefixListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectIPv4PrefixListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_ipv4_prefix_list_profile_parcel"
+}
+
+func (d *PolicyObjectIPv4PrefixListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object IPv4 Prefix List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv4 Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: "IPv4 address",
+ Computed: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix length",
+ Computed: true,
+ },
+ "le": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix length with le range operator",
+ Computed: true,
+ },
+ "ge": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix length with ge range operator",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectIPv4PrefixListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectIPv4PrefixListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectIPv4PrefixList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_ipv4_prefix_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_ipv4_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..e879b27c
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_ipv4_prefix_list_profile_parcel_test.go
@@ -0,0 +1,84 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectIPv4PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.le", "24"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.ge", "16"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectIPv4PrefixListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectIPv4PrefixListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectIPv4PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectIPv4PrefixListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` le = 24` + "\n"
+ config += ` ge = 16` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "test" {
+ id = sdwan_policy_object_ipv4_prefix_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..0dfb5e82
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go
@@ -0,0 +1,145 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectIPv6PrefixListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectIPv6PrefixListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectIPv6PrefixListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectIPv6PrefixListProfileParcelDataSource{}
+}
+
+type PolicyObjectIPv6PrefixListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectIPv6PrefixListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_ipv6_prefix_list_profile_parcel"
+}
+
+func (d *PolicyObjectIPv6PrefixListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object IPv6 Prefix List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv6 Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: "IPv6 address",
+ Computed: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix length",
+ Computed: true,
+ },
+ "le": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix length with le range operator",
+ Computed: true,
+ },
+ "ge": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix length with ge range operator",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectIPv6PrefixListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectIPv6PrefixListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectIPv6PrefixList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..43507b98
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_list_profile_parcel_test.go
@@ -0,0 +1,85 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectIPv6PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.le", "100"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.ge", "70"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectIPv6PrefixListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectIPv6PrefixListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectIPv6PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectIPv6PrefixListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` le = 100` + "\n"
+ config += ` ge = 70` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "test" {
+ id = sdwan_policy_object_ipv6_prefix_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel.go
new file mode 100644
index 00000000..cc5422f6
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel.go
@@ -0,0 +1,145 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectIPv6PrefixProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectIPv6PrefixProfileParcelDataSource{}
+)
+
+func NewPolicyObjectIPv6PrefixProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectIPv6PrefixProfileParcelDataSource{}
+}
+
+type PolicyObjectIPv6PrefixProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectIPv6PrefixProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_ipv6_prefix_profile_parcel"
+}
+
+func (d *PolicyObjectIPv6PrefixProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object IPv6 Prefix profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv6 Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: "IPv6 address",
+ Computed: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix length",
+ Computed: true,
+ },
+ "le_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix length with le range operator",
+ Computed: true,
+ },
+ "ge_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv6 prefix length with ge range operator",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectIPv6PrefixProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectIPv6PrefixProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectIPv6Prefix
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..f4cad25f
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go
@@ -0,0 +1,80 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.le_range_prefix_length", "100"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ge_range_prefix_length", "70"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectIPv6PrefixProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` le_range_prefix_length = 100` + "\n"
+ config += ` ge_range_prefix_length = 70` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" {
+ id = sdwan_policy_object_ipv6_prefix_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel.go
new file mode 100644
index 00000000..866e0ad4
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel.go
@@ -0,0 +1,137 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectMirrorProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectMirrorProfileParcelDataSource{}
+)
+
+func NewPolicyObjectMirrorProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectMirrorProfileParcelDataSource{}
+}
+
+type PolicyObjectMirrorProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectMirrorProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_mirror_profile_parcel"
+}
+
+func (d *PolicyObjectMirrorProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Mirror profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "Mirror List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "remote_destination_ip": schema.StringAttribute{
+ MarkdownDescription: "remote destination ip address",
+ Computed: true,
+ },
+ "source_ip": schema.StringAttribute{
+ MarkdownDescription: "source ip address",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectMirrorProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectMirrorProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectMirror
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel_test.go
new file mode 100644
index 00000000..29d32916
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_mirror_profile_parcel_test.go
@@ -0,0 +1,80 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectMirrorProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_mirror_profile_parcel.test", "entries.0.remote_destination_ip", "10.0.0.1"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_mirror_profile_parcel.test", "entries.0.source_ip", "10.0.0.2"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectMirrorProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectMirrorProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_mirror_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` remote_destination_ip = "10.0.0.1"` + "\n"
+ config += ` source_ip = "10.0.0.2"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_mirror_profile_parcel" "test" {
+ id = sdwan_policy_object_mirror_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel.go
new file mode 100644
index 00000000..afe3f59d
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel.go
@@ -0,0 +1,141 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectPolicerProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectPolicerProfileParcelDataSource{}
+)
+
+func NewPolicyObjectPolicerProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectPolicerProfileParcelDataSource{}
+}
+
+type PolicyObjectPolicerProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectPolicerProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_policer_profile_parcel"
+}
+
+func (d *PolicyObjectPolicerProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Policer profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "Policer Entries",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "burst_bytes": schema.Int64Attribute{
+ MarkdownDescription: "Burst (Bytes)",
+ Computed: true,
+ },
+ "exceed_action": schema.StringAttribute{
+ MarkdownDescription: "Exceed options such as Drop or Remark",
+ Computed: true,
+ },
+ "rate_bps": schema.Int64Attribute{
+ MarkdownDescription: "Rate (bps)",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectPolicerProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectPolicerProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectPolicer
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel_test.go
new file mode 100644
index 00000000..19885ad4
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_policer_profile_parcel_test.go
@@ -0,0 +1,83 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectPolicerProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_policer_profile_parcel.test", "entries.0.burst_bytes", "56500"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_policer_profile_parcel.test", "entries.0.exceed_action", "remark"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_policer_profile_parcel.test", "entries.0.rate_bps", "60000"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectPolicerProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectPolicerProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_policer_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` burst_bytes = 56500` + "\n"
+ config += ` exceed_action = "remark"` + "\n"
+ config += ` rate_bps = 60000` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_policer_profile_parcel" "test" {
+ id = sdwan_policy_object_policer_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel.go
new file mode 100644
index 00000000..185b8705
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel.go
@@ -0,0 +1,145 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectPrefixProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectPrefixProfileParcelDataSource{}
+)
+
+func NewPolicyObjectPrefixProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectPrefixProfileParcelDataSource{}
+}
+
+type PolicyObjectPrefixProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectPrefixProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_prefix_profile_parcel"
+}
+
+func (d *PolicyObjectPrefixProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object Prefix profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "IPv4 Prefix List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: "IPv4 address",
+ Computed: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix length",
+ Computed: true,
+ },
+ "le_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix length with le range operator",
+ Computed: true,
+ },
+ "ge_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: "IPv4 prefix length with ge range operator",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectPrefixProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectPrefixProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectPrefix
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..13614f0f
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_prefix_profile_parcel_test.go
@@ -0,0 +1,80 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectPrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_prefix_profile_parcel.test", "entries.0.le_range_prefix_length", "24"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ge_range_prefix_length", "16"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectPrefixProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectPrefixProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` le_range_prefix_length = 24` + "\n"
+ config += ` ge_range_prefix_length = 16` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_prefix_profile_parcel" "test" {
+ id = sdwan_policy_object_prefix_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_tloc_list_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_tloc_list_profile_parcel.go
new file mode 100644
index 00000000..6cd538c8
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_tloc_list_profile_parcel.go
@@ -0,0 +1,145 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectTLOCListProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectTLOCListProfileParcelDataSource{}
+)
+
+func NewPolicyObjectTLOCListProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectTLOCListProfileParcelDataSource{}
+}
+
+type PolicyObjectTLOCListProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectTLOCListProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_tloc_list_profile_parcel"
+}
+
+func (d *PolicyObjectTLOCListProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object TLOC List profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "TLOC List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "tloc_ip": schema.StringAttribute{
+ MarkdownDescription: "tloc",
+ Computed: true,
+ },
+ "color": schema.StringAttribute{
+ MarkdownDescription: "color",
+ Computed: true,
+ },
+ "encapsulation": schema.StringAttribute{
+ MarkdownDescription: "encapsulation",
+ Computed: true,
+ },
+ "preference": schema.StringAttribute{
+ MarkdownDescription: "Preference",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectTLOCListProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectTLOCListProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectTLOCList
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_tloc_list_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_tloc_list_profile_parcel_test.go
new file mode 100644
index 00000000..a850b1d6
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_tloc_list_profile_parcel_test.go
@@ -0,0 +1,85 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectTLOCListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.tloc_ip", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.color", "3g"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.encapsulation", "gre"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.preference", "33"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectTLOCListPrerequisitesProfileParcelConfig + testAccDataSourceSdwanPolicyObjectTLOCListProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccDataSourceSdwanPolicyObjectTLOCListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectTLOCListProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_tloc_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` tloc_ip = "10.0.0.0"` + "\n"
+ config += ` color = "3g"` + "\n"
+ config += ` encapsulation = "gre"` + "\n"
+ config += ` preference = "33"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_tloc_list_profile_parcel" "test" {
+ id = sdwan_policy_object_tloc_list_profile_parcel.test.id
+ feature_profile_id = var.policy_object_feature_template_id
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel.go b/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel.go
new file mode 100644
index 00000000..bf823842
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel.go
@@ -0,0 +1,145 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/datasource"
+ "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure the implementation satisfies the expected interfaces.
+var (
+ _ datasource.DataSource = &PolicyObjectTLOCProfileParcelDataSource{}
+ _ datasource.DataSourceWithConfigure = &PolicyObjectTLOCProfileParcelDataSource{}
+)
+
+func NewPolicyObjectTLOCProfileParcelDataSource() datasource.DataSource {
+ return &PolicyObjectTLOCProfileParcelDataSource{}
+}
+
+type PolicyObjectTLOCProfileParcelDataSource struct {
+ client *sdwan.Client
+}
+
+func (d *PolicyObjectTLOCProfileParcelDataSource) Metadata(_ context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_tloc_profile_parcel"
+}
+
+func (d *PolicyObjectTLOCProfileParcelDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: "This data source can read the Policy Object TLOC profile parcel.",
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Required: true,
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Computed: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Computed: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: "Feature Profile ID",
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: "TLOC List",
+ Computed: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "tloc": schema.StringAttribute{
+ MarkdownDescription: "tloc",
+ Computed: true,
+ },
+ "color": schema.StringAttribute{
+ MarkdownDescription: "color",
+ Computed: true,
+ },
+ "encapsulation": schema.StringAttribute{
+ MarkdownDescription: "encapsulation",
+ Computed: true,
+ },
+ "preference": schema.StringAttribute{
+ MarkdownDescription: "Preference",
+ Computed: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (d *PolicyObjectTLOCProfileParcelDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, _ *datasource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ d.client = req.ProviderData.(*SdwanProviderData).Client
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (d *PolicyObjectTLOCProfileParcelDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) {
+ var config PolicyObjectTLOC
+
+ // Read config
+ diags := req.Config.Get(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", config.Id.String()))
+
+ res, err := d.client.Get(config.getPath() + "/" + url.QueryEscape(config.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object, got error: %s", err))
+ return
+ }
+
+ config.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", config.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &config)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
diff --git a/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel_test.go b/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel_test.go
new file mode 100644
index 00000000..fea8895b
--- /dev/null
+++ b/internal/provider/data_source_sdwan_policy_object_tloc_profile_parcel_test.go
@@ -0,0 +1,80 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource
+func TestAccDataSourceSdwanPolicyObjectTLOCProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_profile_parcel.test", "entries.0.tloc", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_profile_parcel.test", "entries.0.color", "3g"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_profile_parcel.test", "entries.0.encapsulation", "gre"))
+ checks = append(checks, resource.TestCheckResourceAttr("data.sdwan_policy_object_tloc_profile_parcel.test", "entries.0.preference", "33"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccDataSourceSdwanPolicyObjectTLOCProfileParcelConfig(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAccDataSource
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSourceConfig
+func testAccDataSourceSdwanPolicyObjectTLOCProfileParcelConfig() string {
+ config := `resource "sdwan_policy_object_tloc_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` tloc = "10.0.0.0"` + "\n"
+ config += ` color = "3g"` + "\n"
+ config += ` encapsulation = "gre"` + "\n"
+ config += ` preference = "33"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+
+ config += `
+ data "sdwan_policy_object_tloc_profile_parcel" "test" {
+ id = sdwan_policy_object_tloc_profile_parcel.test.id
+ feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `
+ }
+ `
+ return config
+}
+
+// End of section. //template:end testAccDataSourceConfig
diff --git a/internal/provider/model_sdwan_policy_object_class_map_profile_parcel.go b/internal/provider/model_sdwan_policy_object_class_map_profile_parcel.go
new file mode 100644
index 00000000..2f318f66
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_class_map_profile_parcel.go
@@ -0,0 +1,175 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectClassMap struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectClassMapEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectClassMapEntries struct {
+ Queue types.String `tfsdk:"queue"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectClassMap) getModel() string {
+ return "policy_object_class_map"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectClassMap) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/class", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectClassMap) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Queue.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "queue.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "queue.value", item.Queue.ValueString())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectClassMap) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectClassMapEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectClassMapEntries{}
+ item.Queue = types.StringNull()
+
+ if t := v.Get("queue.optionType"); t.Exists() {
+ va := v.Get("queue.value")
+ if t.String() == "global" {
+ item.Queue = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectClassMap) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"queue"}
+ keyValues := [...]string{data.Entries[i].Queue.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Queue = types.StringNull()
+
+ if t := r.Get("queue.optionType"); t.Exists() {
+ va := r.Get("queue.value")
+ if t.String() == "global" {
+ data.Entries[i].Queue = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectClassMap) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_color_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_color_list_profile_parcel.go
new file mode 100644
index 00000000..04121cba
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_color_list_profile_parcel.go
@@ -0,0 +1,175 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectColorList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectColorListEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectColorListEntries struct {
+ Color types.String `tfsdk:"color"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectColorList) getModel() string {
+ return "policy_object_color_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectColorList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/color", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectColorList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Color.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "color.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "color.value", item.Color.ValueString())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectColorList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectColorListEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectColorListEntries{}
+ item.Color = types.StringNull()
+
+ if t := v.Get("color.optionType"); t.Exists() {
+ va := v.Get("color.value")
+ if t.String() == "global" {
+ item.Color = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectColorList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"color"}
+ keyValues := [...]string{data.Entries[i].Color.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Color = types.StringNull()
+
+ if t := r.Get("color.optionType"); t.Exists() {
+ va := r.Get("color.value")
+ if t.String() == "global" {
+ data.Entries[i].Color = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectColorList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_color_profile_parcel.go b/internal/provider/model_sdwan_policy_object_color_profile_parcel.go
new file mode 100644
index 00000000..f7ff1f7e
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_color_profile_parcel.go
@@ -0,0 +1,171 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectColor struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectColorEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectColorEntries struct {
+ Color types.String `tfsdk:"color"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectColor) getModel() string {
+ return "policy_object_color"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectColor) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/color", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectColor) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Color.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "color.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "color.value", item.Color.ValueString())
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectColor) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectColorEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectColorEntries{}
+ item.Color = types.StringNull()
+
+ if t := v.Get("color.optionType"); t.Exists() {
+ va := v.Get("color.value")
+ if t.String() == "global" {
+ item.Color = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectColor) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"color"}
+ keyValues := [...]string{data.Entries[i].Color.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Color = types.StringNull()
+
+ if t := r.Get("color.optionType"); t.Exists() {
+ va := r.Get("color.value")
+ if t.String() == "global" {
+ data.Entries[i].Color = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectColor) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..7728ecf9
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go
@@ -0,0 +1,198 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectDataIPv4PrefixList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectDataIPv4PrefixListEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectDataIPv4PrefixListEntries struct {
+ Ipv4Address types.String `tfsdk:"ipv4_address"`
+ Ipv4PrefixLength types.Int64 `tfsdk:"ipv4_prefix_length"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectDataIPv4PrefixList) getModel() string {
+ return "policy_object_data_ipv4_prefix_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectDataIPv4PrefixList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/data-prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectDataIPv4PrefixList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv4Address.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.value", item.Ipv4Address.ValueString())
+ }
+ }
+ if !item.Ipv4PrefixLength.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.value", item.Ipv4PrefixLength.ValueInt64())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectDataIPv4PrefixList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectDataIPv4PrefixListEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectDataIPv4PrefixListEntries{}
+ item.Ipv4Address = types.StringNull()
+
+ if t := v.Get("ipv4Address.optionType"); t.Exists() {
+ va := v.Get("ipv4Address.value")
+ if t.String() == "global" {
+ item.Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv4PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectDataIPv4PrefixList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv4Address"}
+ keyValues := [...]string{data.Entries[i].Ipv4Address.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv4Address = types.StringNull()
+
+ if t := r.Get("ipv4Address.optionType"); t.Exists() {
+ va := r.Get("ipv4Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv4PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectDataIPv4PrefixList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..b4c88ecd
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go
@@ -0,0 +1,198 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectDataIPv6PrefixList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectDataIPv6PrefixListEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectDataIPv6PrefixListEntries struct {
+ Ipv6Address types.String `tfsdk:"ipv6_address"`
+ Ipv6PrefixLength types.Int64 `tfsdk:"ipv6_prefix_length"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectDataIPv6PrefixList) getModel() string {
+ return "policy_object_data_ipv6_prefix_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectDataIPv6PrefixList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/data-ipv6-prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectDataIPv6PrefixList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv6Address.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.value", item.Ipv6Address.ValueString())
+ }
+ }
+ if !item.Ipv6PrefixLength.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.value", item.Ipv6PrefixLength.ValueInt64())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectDataIPv6PrefixList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectDataIPv6PrefixListEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectDataIPv6PrefixListEntries{}
+ item.Ipv6Address = types.StringNull()
+
+ if t := v.Get("ipv6Address.optionType"); t.Exists() {
+ va := v.Get("ipv6Address.value")
+ if t.String() == "global" {
+ item.Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv6PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectDataIPv6PrefixList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv6Address"}
+ keyValues := [...]string{data.Entries[i].Ipv6Address.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv6Address = types.StringNull()
+
+ if t := r.Get("ipv6Address.optionType"); t.Exists() {
+ va := r.Get("ipv6Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv6PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectDataIPv6PrefixList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go b/internal/provider/model_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go
new file mode 100644
index 00000000..39f352f9
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go
@@ -0,0 +1,192 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectDataIPv6Prefix struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectDataIPv6PrefixEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectDataIPv6PrefixEntries struct {
+ Ipv6Address types.String `tfsdk:"ipv6_address"`
+ Ipv6PrefixLength types.Int64 `tfsdk:"ipv6_prefix_length"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectDataIPv6Prefix) getModel() string {
+ return "policy_object_data_ipv6_prefix"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectDataIPv6Prefix) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/data-ipv6-prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectDataIPv6Prefix) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv6Address.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.value", item.Ipv6Address.ValueString())
+ }
+ if !item.Ipv6PrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.value", item.Ipv6PrefixLength.ValueInt64())
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectDataIPv6Prefix) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectDataIPv6PrefixEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectDataIPv6PrefixEntries{}
+ item.Ipv6Address = types.StringNull()
+
+ if t := v.Get("ipv6Address.optionType"); t.Exists() {
+ va := v.Get("ipv6Address.value")
+ if t.String() == "global" {
+ item.Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv6PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectDataIPv6Prefix) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv6Address"}
+ keyValues := [...]string{data.Entries[i].Ipv6Address.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv6Address = types.StringNull()
+
+ if t := r.Get("ipv6Address.optionType"); t.Exists() {
+ va := r.Get("ipv6Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv6PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectDataIPv6Prefix) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_data_prefix_profile_parcel.go b/internal/provider/model_sdwan_policy_object_data_prefix_profile_parcel.go
new file mode 100644
index 00000000..54125af5
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_data_prefix_profile_parcel.go
@@ -0,0 +1,192 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectDataPrefix struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectDataPrefixEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectDataPrefixEntries struct {
+ Ipv4Address types.String `tfsdk:"ipv4_address"`
+ Ipv4PrefixLength types.Int64 `tfsdk:"ipv4_prefix_length"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectDataPrefix) getModel() string {
+ return "policy_object_data_prefix"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectDataPrefix) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/data-prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectDataPrefix) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv4Address.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.value", item.Ipv4Address.ValueString())
+ }
+ if !item.Ipv4PrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.value", item.Ipv4PrefixLength.ValueInt64())
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectDataPrefix) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectDataPrefixEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectDataPrefixEntries{}
+ item.Ipv4Address = types.StringNull()
+
+ if t := v.Get("ipv4Address.optionType"); t.Exists() {
+ va := v.Get("ipv4Address.value")
+ if t.String() == "global" {
+ item.Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv4PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectDataPrefix) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv4Address"}
+ keyValues := [...]string{data.Entries[i].Ipv4Address.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv4Address = types.StringNull()
+
+ if t := r.Get("ipv4Address.optionType"); t.Exists() {
+ va := r.Get("ipv4Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv4PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectDataPrefix) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_expanded_community_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_expanded_community_list_profile_parcel.go
new file mode 100644
index 00000000..4991c8bb
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_expanded_community_list_profile_parcel.go
@@ -0,0 +1,146 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectExpandedCommunityList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ ExpandedCommunityLists types.Set `tfsdk:"expanded_community_lists"`
+ ExpandedCommunityListsVariable types.String `tfsdk:"expanded_community_lists_variable"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectExpandedCommunityList) getModel() string {
+ return "policy_object_expanded_community_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectExpandedCommunityList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/expanded-community", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectExpandedCommunityList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ if !data.ExpandedCommunityListsVariable.IsNull() {
+ if true {
+ body, _ = sjson.Set(body, path+"expandedCommunityList.optionType", "variable")
+ body, _ = sjson.Set(body, path+"expandedCommunityList.value", data.ExpandedCommunityListsVariable.ValueString())
+ }
+ } else if !data.ExpandedCommunityLists.IsNull() {
+ if true {
+ body, _ = sjson.Set(body, path+"expandedCommunityList.optionType", "global")
+ var values []string
+ data.ExpandedCommunityLists.ElementsAs(ctx, &values, false)
+ body, _ = sjson.Set(body, path+"expandedCommunityList.value", values)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectExpandedCommunityList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ data.ExpandedCommunityLists = types.SetNull(types.StringType)
+ data.ExpandedCommunityListsVariable = types.StringNull()
+ if t := res.Get(path + "expandedCommunityList.optionType"); t.Exists() {
+ va := res.Get(path + "expandedCommunityList.value")
+ if t.String() == "variable" {
+ data.ExpandedCommunityListsVariable = types.StringValue(va.String())
+ } else if t.String() == "global" {
+ data.ExpandedCommunityLists = helpers.GetStringSet(va.Array())
+ }
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectExpandedCommunityList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ data.ExpandedCommunityLists = types.SetNull(types.StringType)
+ data.ExpandedCommunityListsVariable = types.StringNull()
+ if t := res.Get(path + "expandedCommunityList.optionType"); t.Exists() {
+ va := res.Get(path + "expandedCommunityList.value")
+ if t.String() == "variable" {
+ data.ExpandedCommunityListsVariable = types.StringValue(va.String())
+ } else if t.String() == "global" {
+ data.ExpandedCommunityLists = helpers.GetStringSet(va.Array())
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectExpandedCommunityList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if !data.ExpandedCommunityLists.IsNull() {
+ return false
+ }
+ if !data.ExpandedCommunityListsVariable.IsNull() {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_expanded_community_profile_parcel.go b/internal/provider/model_sdwan_policy_object_expanded_community_profile_parcel.go
new file mode 100644
index 00000000..7364c7c7
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_expanded_community_profile_parcel.go
@@ -0,0 +1,142 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectExpandedCommunity struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ ExpandedCommunityLists types.Set `tfsdk:"expanded_community_lists"`
+ ExpandedCommunityListsVariable types.String `tfsdk:"expanded_community_lists_variable"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectExpandedCommunity) getModel() string {
+ return "policy_object_expanded_community"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectExpandedCommunity) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/expanded-community", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectExpandedCommunity) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ if !data.ExpandedCommunityListsVariable.IsNull() {
+ body, _ = sjson.Set(body, path+"expandedCommunityList.optionType", "variable")
+ body, _ = sjson.Set(body, path+"expandedCommunityList.value", data.ExpandedCommunityListsVariable.ValueString())
+ } else if !data.ExpandedCommunityLists.IsNull() {
+ body, _ = sjson.Set(body, path+"expandedCommunityList.optionType", "global")
+ var values []string
+ data.ExpandedCommunityLists.ElementsAs(ctx, &values, false)
+ body, _ = sjson.Set(body, path+"expandedCommunityList.value", values)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectExpandedCommunity) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ data.ExpandedCommunityLists = types.SetNull(types.StringType)
+ data.ExpandedCommunityListsVariable = types.StringNull()
+ if t := res.Get(path + "expandedCommunityList.optionType"); t.Exists() {
+ va := res.Get(path + "expandedCommunityList.value")
+ if t.String() == "variable" {
+ data.ExpandedCommunityListsVariable = types.StringValue(va.String())
+ } else if t.String() == "global" {
+ data.ExpandedCommunityLists = helpers.GetStringSet(va.Array())
+ }
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectExpandedCommunity) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ data.ExpandedCommunityLists = types.SetNull(types.StringType)
+ data.ExpandedCommunityListsVariable = types.StringNull()
+ if t := res.Get(path + "expandedCommunityList.optionType"); t.Exists() {
+ va := res.Get(path + "expandedCommunityList.value")
+ if t.String() == "variable" {
+ data.ExpandedCommunityListsVariable = types.StringValue(va.String())
+ } else if t.String() == "global" {
+ data.ExpandedCommunityLists = helpers.GetStringSet(va.Array())
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectExpandedCommunity) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if !data.ExpandedCommunityLists.IsNull() {
+ return false
+ }
+ if !data.ExpandedCommunityListsVariable.IsNull() {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_extended_community_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_extended_community_list_profile_parcel.go
new file mode 100644
index 00000000..2cf26888
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_extended_community_list_profile_parcel.go
@@ -0,0 +1,175 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectExtendedCommunityList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectExtendedCommunityListEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectExtendedCommunityListEntries struct {
+ ExtendedCommunity types.String `tfsdk:"extended_community"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectExtendedCommunityList) getModel() string {
+ return "policy_object_extended_community_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectExtendedCommunityList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/ext-community", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectExtendedCommunityList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+ body, _ = sjson.Set(body, path+"entries", []interface{}{})
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.ExtendedCommunity.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "extCommunity.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "extCommunity.value", item.ExtendedCommunity.ValueString())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectExtendedCommunityList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectExtendedCommunityListEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectExtendedCommunityListEntries{}
+ item.ExtendedCommunity = types.StringNull()
+
+ if t := v.Get("extCommunity.optionType"); t.Exists() {
+ va := v.Get("extCommunity.value")
+ if t.String() == "global" {
+ item.ExtendedCommunity = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectExtendedCommunityList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"extCommunity"}
+ keyValues := [...]string{data.Entries[i].ExtendedCommunity.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].ExtendedCommunity = types.StringNull()
+
+ if t := r.Get("extCommunity.optionType"); t.Exists() {
+ va := r.Get("extCommunity.value")
+ if t.String() == "global" {
+ data.Entries[i].ExtendedCommunity = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectExtendedCommunityList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_extended_community_profile_parcel.go b/internal/provider/model_sdwan_policy_object_extended_community_profile_parcel.go
new file mode 100644
index 00000000..8a4c9d9a
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_extended_community_profile_parcel.go
@@ -0,0 +1,171 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectExtendedCommunity struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectExtendedCommunityEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectExtendedCommunityEntries struct {
+ ExtendedCommunity types.String `tfsdk:"extended_community"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectExtendedCommunity) getModel() string {
+ return "policy_object_extended_community"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectExtendedCommunity) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/ext-community", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectExtendedCommunity) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ body, _ = sjson.Set(body, path+"entries", []interface{}{})
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.ExtendedCommunity.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "extCommunity.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "extCommunity.value", item.ExtendedCommunity.ValueString())
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectExtendedCommunity) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectExtendedCommunityEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectExtendedCommunityEntries{}
+ item.ExtendedCommunity = types.StringNull()
+
+ if t := v.Get("extCommunity.optionType"); t.Exists() {
+ va := v.Get("extCommunity.value")
+ if t.String() == "global" {
+ item.ExtendedCommunity = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectExtendedCommunity) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"extCommunity"}
+ keyValues := [...]string{data.Entries[i].ExtendedCommunity.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].ExtendedCommunity = types.StringNull()
+
+ if t := r.Get("extCommunity.optionType"); t.Exists() {
+ va := r.Get("extCommunity.value")
+ if t.String() == "global" {
+ data.Entries[i].ExtendedCommunity = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectExtendedCommunity) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_feature_profile.go b/internal/provider/model_sdwan_policy_object_feature_profile.go
new file mode 100644
index 00000000..218379b3
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_feature_profile.go
@@ -0,0 +1,93 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectFeatureProfile struct {
+ Id types.String `tfsdk:"id"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectFeatureProfile) getPath() string {
+ return "/v1/feature-profile/sdwan/policy-object/"
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectFeatureProfile) toBody(ctx context.Context) string {
+ body := ""
+ if !data.Name.IsNull() {
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ }
+ if !data.Description.IsNull() {
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectFeatureProfile) fromBody(ctx context.Context, res gjson.Result) {
+ if value := res.Get("profileName"); value.Exists() {
+ data.Name = types.StringValue(value.String())
+ } else {
+ data.Name = types.StringNull()
+ }
+ if value := res.Get("description"); value.Exists() {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin hasChanges
+func (data *PolicyObjectFeatureProfile) hasChanges(ctx context.Context, state *PolicyObjectFeatureProfile) bool {
+ hasChanges := false
+ if !data.Name.Equal(state.Name) {
+ hasChanges = true
+ }
+ if !data.Description.Equal(state.Description) {
+ hasChanges = true
+ }
+ return hasChanges
+}
+
+// End of section. //template:end hasChanges
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateVersions
+
+// End of section. //template:end updateVersions
diff --git a/internal/provider/model_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..2d9c6a8c
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go
@@ -0,0 +1,245 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "strconv"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectIPv4PrefixList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectIPv4PrefixListEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectIPv4PrefixListEntries struct {
+ Ipv4Address types.String `tfsdk:"ipv4_address"`
+ Ipv4PrefixLength types.Int64 `tfsdk:"ipv4_prefix_length"`
+ Le types.Int64 `tfsdk:"le"`
+ Ge types.Int64 `tfsdk:"ge"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectIPv4PrefixList) getModel() string {
+ return "policy_object_ipv4_prefix_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectIPv4PrefixList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectIPv4PrefixList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv4Address.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.value", item.Ipv4Address.ValueString())
+ }
+ }
+ if !item.Ipv4PrefixLength.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.value", item.Ipv4PrefixLength.ValueInt64())
+ }
+ }
+ if !item.Le.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.value", item.Le.ValueInt64())
+ }
+ }
+ if !item.Ge.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.value", item.Ge.ValueInt64())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectIPv4PrefixList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectIPv4PrefixListEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectIPv4PrefixListEntries{}
+ item.Ipv4Address = types.StringNull()
+
+ if t := v.Get("ipv4Address.optionType"); t.Exists() {
+ va := v.Get("ipv4Address.value")
+ if t.String() == "global" {
+ item.Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv4PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ item.Le = types.Int64Null()
+
+ if t := v.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ item.Le = types.Int64Value(va.Int())
+ }
+ }
+ item.Ge = types.Int64Null()
+
+ if t := v.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ item.Ge = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectIPv4PrefixList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv4Address", "ipv4PrefixLength"}
+ keyValues := [...]string{data.Entries[i].Ipv4Address.ValueString(), strconv.FormatInt(data.Entries[i].Ipv4PrefixLength.ValueInt64(), 10)}
+ keyValuesVariables := [...]string{"", ""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv4Address = types.StringNull()
+
+ if t := r.Get("ipv4Address.optionType"); t.Exists() {
+ va := r.Get("ipv4Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv4PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].Le = types.Int64Null()
+
+ if t := r.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Le = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].Ge = types.Int64Null()
+
+ if t := r.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ge = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectIPv4PrefixList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..4d1983bb
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go
@@ -0,0 +1,245 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "strconv"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectIPv6PrefixList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectIPv6PrefixListEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectIPv6PrefixListEntries struct {
+ Ipv6Address types.String `tfsdk:"ipv6_address"`
+ Ipv6PrefixLength types.Int64 `tfsdk:"ipv6_prefix_length"`
+ Le types.Int64 `tfsdk:"le"`
+ Ge types.Int64 `tfsdk:"ge"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectIPv6PrefixList) getModel() string {
+ return "policy_object_ipv6_prefix_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectIPv6PrefixList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/ipv6-prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectIPv6PrefixList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv6Address.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.value", item.Ipv6Address.ValueString())
+ }
+ }
+ if !item.Ipv6PrefixLength.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.value", item.Ipv6PrefixLength.ValueInt64())
+ }
+ }
+ if !item.Le.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.value", item.Le.ValueInt64())
+ }
+ }
+ if !item.Ge.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.value", item.Ge.ValueInt64())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectIPv6PrefixList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectIPv6PrefixListEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectIPv6PrefixListEntries{}
+ item.Ipv6Address = types.StringNull()
+
+ if t := v.Get("ipv6Address.optionType"); t.Exists() {
+ va := v.Get("ipv6Address.value")
+ if t.String() == "global" {
+ item.Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv6PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ item.Le = types.Int64Null()
+
+ if t := v.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ item.Le = types.Int64Value(va.Int())
+ }
+ }
+ item.Ge = types.Int64Null()
+
+ if t := v.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ item.Ge = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectIPv6PrefixList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv6Address", "ipv6PrefixLength"}
+ keyValues := [...]string{data.Entries[i].Ipv6Address.ValueString(), strconv.FormatInt(data.Entries[i].Ipv6PrefixLength.ValueInt64(), 10)}
+ keyValuesVariables := [...]string{"", ""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv6Address = types.StringNull()
+
+ if t := r.Get("ipv6Address.optionType"); t.Exists() {
+ va := r.Get("ipv6Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv6PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].Le = types.Int64Null()
+
+ if t := r.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Le = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].Ge = types.Int64Null()
+
+ if t := r.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ge = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectIPv6PrefixList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_ipv6_prefix_profile_parcel.go b/internal/provider/model_sdwan_policy_object_ipv6_prefix_profile_parcel.go
new file mode 100644
index 00000000..fdedf849
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_ipv6_prefix_profile_parcel.go
@@ -0,0 +1,235 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "strconv"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectIPv6Prefix struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectIPv6PrefixEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectIPv6PrefixEntries struct {
+ Ipv6Address types.String `tfsdk:"ipv6_address"`
+ Ipv6PrefixLength types.Int64 `tfsdk:"ipv6_prefix_length"`
+ LeRangePrefixLength types.Int64 `tfsdk:"le_range_prefix_length"`
+ GeRangePrefixLength types.Int64 `tfsdk:"ge_range_prefix_length"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectIPv6Prefix) getModel() string {
+ return "policy_object_ipv6_prefix"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectIPv6Prefix) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/ipv6-prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectIPv6Prefix) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv6Address.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6Address.value", item.Ipv6Address.ValueString())
+ }
+ if !item.Ipv6PrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv6PrefixLength.value", item.Ipv6PrefixLength.ValueInt64())
+ }
+ if !item.LeRangePrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.value", item.LeRangePrefixLength.ValueInt64())
+ }
+ if !item.GeRangePrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.value", item.GeRangePrefixLength.ValueInt64())
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectIPv6Prefix) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectIPv6PrefixEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectIPv6PrefixEntries{}
+ item.Ipv6Address = types.StringNull()
+
+ if t := v.Get("ipv6Address.optionType"); t.Exists() {
+ va := v.Get("ipv6Address.value")
+ if t.String() == "global" {
+ item.Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv6PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ item.LeRangePrefixLength = types.Int64Null()
+
+ if t := v.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ item.LeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ item.GeRangePrefixLength = types.Int64Null()
+
+ if t := v.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ item.GeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectIPv6Prefix) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv6Address", "ipv6PrefixLength"}
+ keyValues := [...]string{data.Entries[i].Ipv6Address.ValueString(), strconv.FormatInt(data.Entries[i].Ipv6PrefixLength.ValueInt64(), 10)}
+ keyValuesVariables := [...]string{"", ""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv6Address = types.StringNull()
+
+ if t := r.Get("ipv6Address.optionType"); t.Exists() {
+ va := r.Get("ipv6Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv6PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv6PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv6PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv6PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].LeRangePrefixLength = types.Int64Null()
+
+ if t := r.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].LeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].GeRangePrefixLength = types.Int64Null()
+
+ if t := r.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].GeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectIPv6Prefix) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_mirror_profile_parcel.go b/internal/provider/model_sdwan_policy_object_mirror_profile_parcel.go
new file mode 100644
index 00000000..21b6d039
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_mirror_profile_parcel.go
@@ -0,0 +1,198 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectMirror struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectMirrorEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectMirrorEntries struct {
+ RemoteDestinationIp types.String `tfsdk:"remote_destination_ip"`
+ SourceIp types.String `tfsdk:"source_ip"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectMirror) getModel() string {
+ return "policy_object_mirror"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectMirror) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/mirror", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectMirror) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.RemoteDestinationIp.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "remoteDestIp.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "remoteDestIp.value", item.RemoteDestinationIp.ValueString())
+ }
+ }
+ if !item.SourceIp.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "sourceIp.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "sourceIp.value", item.SourceIp.ValueString())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectMirror) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectMirrorEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectMirrorEntries{}
+ item.RemoteDestinationIp = types.StringNull()
+
+ if t := v.Get("remoteDestIp.optionType"); t.Exists() {
+ va := v.Get("remoteDestIp.value")
+ if t.String() == "global" {
+ item.RemoteDestinationIp = types.StringValue(va.String())
+ }
+ }
+ item.SourceIp = types.StringNull()
+
+ if t := v.Get("sourceIp.optionType"); t.Exists() {
+ va := v.Get("sourceIp.value")
+ if t.String() == "global" {
+ item.SourceIp = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectMirror) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"remoteDestIp", "sourceIp"}
+ keyValues := [...]string{data.Entries[i].RemoteDestinationIp.ValueString(), data.Entries[i].SourceIp.ValueString()}
+ keyValuesVariables := [...]string{"", ""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].RemoteDestinationIp = types.StringNull()
+
+ if t := r.Get("remoteDestIp.optionType"); t.Exists() {
+ va := r.Get("remoteDestIp.value")
+ if t.String() == "global" {
+ data.Entries[i].RemoteDestinationIp = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].SourceIp = types.StringNull()
+
+ if t := r.Get("sourceIp.optionType"); t.Exists() {
+ va := r.Get("sourceIp.value")
+ if t.String() == "global" {
+ data.Entries[i].SourceIp = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectMirror) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_policer_profile_parcel.go b/internal/provider/model_sdwan_policy_object_policer_profile_parcel.go
new file mode 100644
index 00000000..64622c91
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_policer_profile_parcel.go
@@ -0,0 +1,222 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "strconv"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectPolicer struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectPolicerEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectPolicerEntries struct {
+ BurstBytes types.Int64 `tfsdk:"burst_bytes"`
+ ExceedAction types.String `tfsdk:"exceed_action"`
+ RateBps types.Int64 `tfsdk:"rate_bps"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectPolicer) getModel() string {
+ return "policy_object_policer"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectPolicer) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/policer", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectPolicer) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.BurstBytes.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "burst.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "burst.value", item.BurstBytes.ValueInt64())
+ }
+ }
+ if !item.ExceedAction.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "exceed.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "exceed.value", item.ExceedAction.ValueString())
+ }
+ }
+ if !item.RateBps.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "rate.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "rate.value", item.RateBps.ValueInt64())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectPolicer) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectPolicerEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectPolicerEntries{}
+ item.BurstBytes = types.Int64Null()
+
+ if t := v.Get("burst.optionType"); t.Exists() {
+ va := v.Get("burst.value")
+ if t.String() == "global" {
+ item.BurstBytes = types.Int64Value(va.Int())
+ }
+ }
+ item.ExceedAction = types.StringNull()
+
+ if t := v.Get("exceed.optionType"); t.Exists() {
+ va := v.Get("exceed.value")
+ if t.String() == "global" {
+ item.ExceedAction = types.StringValue(va.String())
+ }
+ }
+ item.RateBps = types.Int64Null()
+
+ if t := v.Get("rate.optionType"); t.Exists() {
+ va := v.Get("rate.value")
+ if t.String() == "global" {
+ item.RateBps = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectPolicer) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"burst", "exceed", "rate"}
+ keyValues := [...]string{strconv.FormatInt(data.Entries[i].BurstBytes.ValueInt64(), 10), data.Entries[i].ExceedAction.ValueString(), strconv.FormatInt(data.Entries[i].RateBps.ValueInt64(), 10)}
+ keyValuesVariables := [...]string{"", "", ""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].BurstBytes = types.Int64Null()
+
+ if t := r.Get("burst.optionType"); t.Exists() {
+ va := r.Get("burst.value")
+ if t.String() == "global" {
+ data.Entries[i].BurstBytes = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].ExceedAction = types.StringNull()
+
+ if t := r.Get("exceed.optionType"); t.Exists() {
+ va := r.Get("exceed.value")
+ if t.String() == "global" {
+ data.Entries[i].ExceedAction = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].RateBps = types.Int64Null()
+
+ if t := r.Get("rate.optionType"); t.Exists() {
+ va := r.Get("rate.value")
+ if t.String() == "global" {
+ data.Entries[i].RateBps = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectPolicer) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_prefix_profile_parcel.go b/internal/provider/model_sdwan_policy_object_prefix_profile_parcel.go
new file mode 100644
index 00000000..83b5cc21
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_prefix_profile_parcel.go
@@ -0,0 +1,235 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "strconv"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectPrefix struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectPrefixEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectPrefixEntries struct {
+ Ipv4Address types.String `tfsdk:"ipv4_address"`
+ Ipv4PrefixLength types.Int64 `tfsdk:"ipv4_prefix_length"`
+ LeRangePrefixLength types.Int64 `tfsdk:"le_range_prefix_length"`
+ GeRangePrefixLength types.Int64 `tfsdk:"ge_range_prefix_length"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectPrefix) getModel() string {
+ return "policy_object_prefix"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectPrefix) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/prefix", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectPrefix) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Ipv4Address.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4Address.value", item.Ipv4Address.ValueString())
+ }
+ if !item.Ipv4PrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "ipv4PrefixLength.value", item.Ipv4PrefixLength.ValueInt64())
+ }
+ if !item.LeRangePrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "leRangePrefixLength.value", item.LeRangePrefixLength.ValueInt64())
+ }
+ if !item.GeRangePrefixLength.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "geRangePrefixLength.value", item.GeRangePrefixLength.ValueInt64())
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectPrefix) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectPrefixEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectPrefixEntries{}
+ item.Ipv4Address = types.StringNull()
+
+ if t := v.Get("ipv4Address.optionType"); t.Exists() {
+ va := v.Get("ipv4Address.value")
+ if t.String() == "global" {
+ item.Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ item.Ipv4PrefixLength = types.Int64Null()
+
+ if t := v.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := v.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ item.Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ item.LeRangePrefixLength = types.Int64Null()
+
+ if t := v.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ item.LeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ item.GeRangePrefixLength = types.Int64Null()
+
+ if t := v.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := v.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ item.GeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectPrefix) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"ipv4Address", "ipv4PrefixLength"}
+ keyValues := [...]string{data.Entries[i].Ipv4Address.ValueString(), strconv.FormatInt(data.Entries[i].Ipv4PrefixLength.ValueInt64(), 10)}
+ keyValuesVariables := [...]string{"", ""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Ipv4Address = types.StringNull()
+
+ if t := r.Get("ipv4Address.optionType"); t.Exists() {
+ va := r.Get("ipv4Address.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4Address = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Ipv4PrefixLength = types.Int64Null()
+
+ if t := r.Get("ipv4PrefixLength.optionType"); t.Exists() {
+ va := r.Get("ipv4PrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].Ipv4PrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].LeRangePrefixLength = types.Int64Null()
+
+ if t := r.Get("leRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("leRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].LeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ data.Entries[i].GeRangePrefixLength = types.Int64Null()
+
+ if t := r.Get("geRangePrefixLength.optionType"); t.Exists() {
+ va := r.Get("geRangePrefixLength.value")
+ if t.String() == "global" {
+ data.Entries[i].GeRangePrefixLength = types.Int64Value(va.Int())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectPrefix) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_tloc_list_profile_parcel.go b/internal/provider/model_sdwan_policy_object_tloc_list_profile_parcel.go
new file mode 100644
index 00000000..945c0c7a
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_tloc_list_profile_parcel.go
@@ -0,0 +1,244 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectTLOCList struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectTLOCListEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectTLOCListEntries struct {
+ TlocIp types.String `tfsdk:"tloc_ip"`
+ Color types.String `tfsdk:"color"`
+ Encapsulation types.String `tfsdk:"encapsulation"`
+ Preference types.String `tfsdk:"preference"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectTLOCList) getModel() string {
+ return "policy_object_tloc_list"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectTLOCList) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/tloc", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectTLOCList) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+ if true {
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.TlocIp.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "tloc.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "tloc.value", item.TlocIp.ValueString())
+ }
+ }
+ if !item.Color.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "color.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "color.value", item.Color.ValueString())
+ }
+ }
+ if !item.Encapsulation.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "encap.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "encap.value", item.Encapsulation.ValueString())
+ }
+ }
+ if !item.Preference.IsNull() {
+ if true {
+ itemBody, _ = sjson.Set(itemBody, "preference.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "preference.value", item.Preference.ValueString())
+ }
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectTLOCList) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectTLOCListEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectTLOCListEntries{}
+ item.TlocIp = types.StringNull()
+
+ if t := v.Get("tloc.optionType"); t.Exists() {
+ va := v.Get("tloc.value")
+ if t.String() == "global" {
+ item.TlocIp = types.StringValue(va.String())
+ }
+ }
+ item.Color = types.StringNull()
+
+ if t := v.Get("color.optionType"); t.Exists() {
+ va := v.Get("color.value")
+ if t.String() == "global" {
+ item.Color = types.StringValue(va.String())
+ }
+ }
+ item.Encapsulation = types.StringNull()
+
+ if t := v.Get("encap.optionType"); t.Exists() {
+ va := v.Get("encap.value")
+ if t.String() == "global" {
+ item.Encapsulation = types.StringValue(va.String())
+ }
+ }
+ item.Preference = types.StringNull()
+
+ if t := v.Get("preference.optionType"); t.Exists() {
+ va := v.Get("preference.value")
+ if t.String() == "global" {
+ item.Preference = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectTLOCList) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"tloc"}
+ keyValues := [...]string{data.Entries[i].TlocIp.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].TlocIp = types.StringNull()
+
+ if t := r.Get("tloc.optionType"); t.Exists() {
+ va := r.Get("tloc.value")
+ if t.String() == "global" {
+ data.Entries[i].TlocIp = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Color = types.StringNull()
+
+ if t := r.Get("color.optionType"); t.Exists() {
+ va := r.Get("color.value")
+ if t.String() == "global" {
+ data.Entries[i].Color = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Encapsulation = types.StringNull()
+
+ if t := r.Get("encap.optionType"); t.Exists() {
+ va := r.Get("encap.value")
+ if t.String() == "global" {
+ data.Entries[i].Encapsulation = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Preference = types.StringNull()
+
+ if t := r.Get("preference.optionType"); t.Exists() {
+ va := r.Get("preference.value")
+ if t.String() == "global" {
+ data.Entries[i].Preference = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectTLOCList) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/model_sdwan_policy_object_tloc_profile_parcel.go b/internal/provider/model_sdwan_policy_object_tloc_profile_parcel.go
new file mode 100644
index 00000000..a8abd4ab
--- /dev/null
+++ b/internal/provider/model_sdwan_policy_object_tloc_profile_parcel.go
@@ -0,0 +1,234 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/tidwall/gjson"
+ "github.com/tidwall/sjson"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin types
+type PolicyObjectTLOC struct {
+ Id types.String `tfsdk:"id"`
+ Version types.Int64 `tfsdk:"version"`
+ Name types.String `tfsdk:"name"`
+ Description types.String `tfsdk:"description"`
+ FeatureProfileId types.String `tfsdk:"feature_profile_id"`
+ Entries []PolicyObjectTLOCEntries `tfsdk:"entries"`
+}
+
+type PolicyObjectTLOCEntries struct {
+ Tloc types.String `tfsdk:"tloc"`
+ Color types.String `tfsdk:"color"`
+ Encapsulation types.String `tfsdk:"encapsulation"`
+ Preference types.String `tfsdk:"preference"`
+}
+
+// End of section. //template:end types
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getModel
+func (data PolicyObjectTLOC) getModel() string {
+ return "policy_object_tloc"
+}
+
+// End of section. //template:end getModel
+
+// Section below is generated&owned by "gen/generator.go". //template:begin getPath
+func (data PolicyObjectTLOC) getPath() string {
+ return fmt.Sprintf("/v1/feature-profile/sdwan/policy-object/%v/tloc", url.QueryEscape(data.FeatureProfileId.ValueString()))
+}
+
+// End of section. //template:end getPath
+
+// Section below is generated&owned by "gen/generator.go". //template:begin toBody
+func (data PolicyObjectTLOC) toBody(ctx context.Context) string {
+ body := ""
+ body, _ = sjson.Set(body, "name", data.Name.ValueString())
+ body, _ = sjson.Set(body, "description", data.Description.ValueString())
+ path := "data."
+
+ for _, item := range data.Entries {
+ itemBody := ""
+ if !item.Tloc.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "tloc.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "tloc.value", item.Tloc.ValueString())
+ }
+ if !item.Color.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "color.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "color.value", item.Color.ValueString())
+ }
+ if !item.Encapsulation.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "encap.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "encap.value", item.Encapsulation.ValueString())
+ }
+ if !item.Preference.IsNull() {
+ itemBody, _ = sjson.Set(itemBody, "preference.optionType", "global")
+ itemBody, _ = sjson.Set(itemBody, "preference.value", item.Preference.ValueString())
+ }
+ body, _ = sjson.SetRaw(body, path+"entries.-1", itemBody)
+ }
+ return body
+}
+
+// End of section. //template:end toBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin fromBody
+func (data *PolicyObjectTLOC) fromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ if value := res.Get(path + "entries"); value.Exists() {
+ data.Entries = make([]PolicyObjectTLOCEntries, 0)
+ value.ForEach(func(k, v gjson.Result) bool {
+ item := PolicyObjectTLOCEntries{}
+ item.Tloc = types.StringNull()
+
+ if t := v.Get("tloc.optionType"); t.Exists() {
+ va := v.Get("tloc.value")
+ if t.String() == "global" {
+ item.Tloc = types.StringValue(va.String())
+ }
+ }
+ item.Color = types.StringNull()
+
+ if t := v.Get("color.optionType"); t.Exists() {
+ va := v.Get("color.value")
+ if t.String() == "global" {
+ item.Color = types.StringValue(va.String())
+ }
+ }
+ item.Encapsulation = types.StringNull()
+
+ if t := v.Get("encap.optionType"); t.Exists() {
+ va := v.Get("encap.value")
+ if t.String() == "global" {
+ item.Encapsulation = types.StringValue(va.String())
+ }
+ }
+ item.Preference = types.StringNull()
+
+ if t := v.Get("preference.optionType"); t.Exists() {
+ va := v.Get("preference.value")
+ if t.String() == "global" {
+ item.Preference = types.StringValue(va.String())
+ }
+ }
+ data.Entries = append(data.Entries, item)
+ return true
+ })
+ }
+}
+
+// End of section. //template:end fromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin updateFromBody
+func (data *PolicyObjectTLOC) updateFromBody(ctx context.Context, res gjson.Result) {
+ data.Name = types.StringValue(res.Get("payload.name").String())
+ if value := res.Get("payload.description"); value.Exists() && value.String() != "" {
+ data.Description = types.StringValue(value.String())
+ } else {
+ data.Description = types.StringNull()
+ }
+ path := "payload.data."
+ for i := range data.Entries {
+ keys := [...]string{"tloc"}
+ keyValues := [...]string{data.Entries[i].Tloc.ValueString()}
+ keyValuesVariables := [...]string{""}
+
+ var r gjson.Result
+ res.Get(path + "entries").ForEach(
+ func(_, v gjson.Result) bool {
+ found := false
+ for ik := range keys {
+ tt := v.Get(keys[ik] + ".optionType").String()
+ vv := v.Get(keys[ik] + ".value").String()
+ if (tt == "variable" && vv == keyValuesVariables[ik]) || (tt == "global" && vv == keyValues[ik]) {
+ found = true
+ continue
+ }
+ found = false
+ break
+ }
+ if found {
+ r = v
+ return false
+ }
+ return true
+ },
+ )
+ data.Entries[i].Tloc = types.StringNull()
+
+ if t := r.Get("tloc.optionType"); t.Exists() {
+ va := r.Get("tloc.value")
+ if t.String() == "global" {
+ data.Entries[i].Tloc = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Color = types.StringNull()
+
+ if t := r.Get("color.optionType"); t.Exists() {
+ va := r.Get("color.value")
+ if t.String() == "global" {
+ data.Entries[i].Color = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Encapsulation = types.StringNull()
+
+ if t := r.Get("encap.optionType"); t.Exists() {
+ va := r.Get("encap.value")
+ if t.String() == "global" {
+ data.Entries[i].Encapsulation = types.StringValue(va.String())
+ }
+ }
+ data.Entries[i].Preference = types.StringNull()
+
+ if t := r.Get("preference.optionType"); t.Exists() {
+ va := r.Get("preference.value")
+ if t.String() == "global" {
+ data.Entries[i].Preference = types.StringValue(va.String())
+ }
+ }
+ }
+}
+
+// End of section. //template:end updateFromBody
+
+// Section below is generated&owned by "gen/generator.go". //template:begin isNull
+func (data *PolicyObjectTLOC) isNull(ctx context.Context, res gjson.Result) bool {
+ if !data.FeatureProfileId.IsNull() {
+ return false
+ }
+ if len(data.Entries) > 0 {
+ return false
+ }
+ return true
+}
+
+// End of section. //template:end isNull
diff --git a/internal/provider/provider.go b/internal/provider/provider.go
index a4a579a5..3d49f596 100644
--- a/internal/provider/provider.go
+++ b/internal/provider/provider.go
@@ -283,6 +283,17 @@ func (p *SdwanProvider) Resources(ctx context.Context) []func() resource.Resourc
NewVPNInterfaceSVIFeatureTemplateResource,
NewVPNInterfaceT1E1SerialFeatureTemplateResource,
NewApplicationPriorityQoSPolicyProfileParcelResource,
+ NewPolicyObjectClassMapProfileParcelResource,
+ NewPolicyObjectColorListProfileParcelResource,
+ NewPolicyObjectDataIPv4PrefixListProfileParcelResource,
+ NewPolicyObjectDataIPv6PrefixListProfileParcelResource,
+ NewPolicyObjectExpandedCommunityListProfileParcelResource,
+ NewPolicyObjectExtendedCommunityListProfileParcelResource,
+ NewPolicyObjectIPv4PrefixListProfileParcelResource,
+ NewPolicyObjectIPv6PrefixListProfileParcelResource,
+ NewPolicyObjectMirrorProfileParcelResource,
+ NewPolicyObjectPolicerProfileParcelResource,
+ NewPolicyObjectTLOCListProfileParcelResource,
NewServiceLANVPNProfileParcelResource,
NewServiceLANVPNInterfaceEthernetProfileParcelResource,
NewServiceLANVPNInterfaceGREProfileParcelResource,
@@ -363,6 +374,7 @@ func (p *SdwanProvider) Resources(ctx context.Context) []func() resource.Resourc
NewMirrorPolicyObjectResource,
NewObjectGroupPolicyDefinitionResource,
NewPolicerPolicyObjectResource,
+ NewPolicyObjectFeatureProfileResource,
NewPortListPolicyObjectResource,
NewPreferredColorGroupPolicyObjectResource,
NewProtocolListPolicyObjectResource,
@@ -437,6 +449,17 @@ func (p *SdwanProvider) DataSources(ctx context.Context) []func() datasource.Dat
NewVPNInterfaceSVIFeatureTemplateDataSource,
NewVPNInterfaceT1E1SerialFeatureTemplateDataSource,
NewApplicationPriorityQoSPolicyProfileParcelDataSource,
+ NewPolicyObjectClassMapProfileParcelDataSource,
+ NewPolicyObjectColorListProfileParcelDataSource,
+ NewPolicyObjectDataIPv4PrefixListProfileParcelDataSource,
+ NewPolicyObjectDataIPv6PrefixListProfileParcelDataSource,
+ NewPolicyObjectExpandedCommunityListProfileParcelDataSource,
+ NewPolicyObjectExtendedCommunityListProfileParcelDataSource,
+ NewPolicyObjectIPv4PrefixListProfileParcelDataSource,
+ NewPolicyObjectIPv6PrefixListProfileParcelDataSource,
+ NewPolicyObjectMirrorProfileParcelDataSource,
+ NewPolicyObjectPolicerProfileParcelDataSource,
+ NewPolicyObjectTLOCListProfileParcelDataSource,
NewServiceLANVPNProfileParcelDataSource,
NewServiceLANVPNInterfaceEthernetProfileParcelDataSource,
NewServiceLANVPNInterfaceGREProfileParcelDataSource,
@@ -518,6 +541,7 @@ func (p *SdwanProvider) DataSources(ctx context.Context) []func() datasource.Dat
NewMirrorPolicyObjectDataSource,
NewObjectGroupPolicyDefinitionDataSource,
NewPolicerPolicyObjectDataSource,
+ NewPolicyObjectFeatureProfileDataSource,
NewPortListPolicyObjectDataSource,
NewPreferredColorGroupPolicyObjectDataSource,
NewProtocolListPolicyObjectDataSource,
diff --git a/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel.go
new file mode 100644
index 00000000..cc183fb2
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel.go
@@ -0,0 +1,257 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectClassMapProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectClassMapProfileParcelResource{}
+
+func NewPolicyObjectClassMapProfileParcelResource() resource.Resource {
+ return &PolicyObjectClassMapProfileParcelResource{}
+}
+
+type PolicyObjectClassMapProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectClassMapProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_class_map_profile_parcel"
+}
+
+func (r *PolicyObjectClassMapProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Class Map profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("class map List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "queue": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("select a queue").AddStringEnumDescription("0", "1", "2", "3", "4", "5", "6", "7").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("0", "1", "2", "3", "4", "5", "6", "7"),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectClassMapProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectClassMapProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectClassMap
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectClassMapProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectClassMap
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectClassMapProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectClassMap
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectClassMapProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectClassMap
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectClassMapProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel_test.go
new file mode 100644
index 00000000..065f0552
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_class_map_profile_parcel_test.go
@@ -0,0 +1,76 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectClassMapProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_class_map_profile_parcel.test", "entries.0.queue", "0"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectClassMapProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectClassMapPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectClassMapProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_class_map_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` queue = "0"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_color_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_color_list_profile_parcel.go
new file mode 100644
index 00000000..5e98f4fd
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_color_list_profile_parcel.go
@@ -0,0 +1,257 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectColorListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectColorListProfileParcelResource{}
+
+func NewPolicyObjectColorListProfileParcelResource() resource.Resource {
+ return &PolicyObjectColorListProfileParcelResource{}
+}
+
+type PolicyObjectColorListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectColorListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_color_list_profile_parcel"
+}
+
+func (r *PolicyObjectColorListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Color List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Color List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "color": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("").AddStringEnumDescription("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver"),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectColorListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectColorListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectColorList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectColorListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectColorList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectColorListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectColorList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectColorListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectColorList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectColorListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_color_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_color_list_profile_parcel_test.go
new file mode 100644
index 00000000..6dfc0a79
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_color_list_profile_parcel_test.go
@@ -0,0 +1,76 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectColorListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_color_list_profile_parcel.test", "entries.0.color", "blue"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectColorListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectColorListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectColorListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectColorListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_color_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` color = "blue"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_color_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_color_profile_parcel.go
new file mode 100644
index 00000000..c06ce474
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_color_profile_parcel.go
@@ -0,0 +1,257 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectColorProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectColorProfileParcelResource{}
+
+func NewPolicyObjectColorProfileParcelResource() resource.Resource {
+ return &PolicyObjectColorProfileParcelResource{}
+}
+
+type PolicyObjectColorProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectColorProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_color_profile_parcel"
+}
+
+func (r *PolicyObjectColorProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Color profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Color List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "color": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("").AddStringEnumDescription("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver"),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectColorProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectColorProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectColor
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectColorProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectColor
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectColorProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectColor
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectColorProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectColor
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectColorProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_color_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_color_profile_parcel_test.go
new file mode 100644
index 00000000..61f155ca
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_color_profile_parcel_test.go
@@ -0,0 +1,85 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectColorProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_color_profile_parcel.test", "entries.0.color", "blue"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectColorProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectColorProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectColorProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_color_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` color = "blue"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectColorProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_color_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` color = "blue"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..a17b209d
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.go
@@ -0,0 +1,261 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectDataIPv4PrefixListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectDataIPv4PrefixListProfileParcelResource{}
+
+func NewPolicyObjectDataIPv4PrefixListProfileParcelResource() resource.Resource {
+ return &PolicyObjectDataIPv4PrefixListProfileParcelResource{}
+}
+
+type PolicyObjectDataIPv4PrefixListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_ipv4_prefix_list_profile_parcel"
+}
+
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Data IPv4 Prefix List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 Data Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 address").String,
+ Optional: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix Length").AddIntegerRangeDescription(0, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(32),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectDataIPv4PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectDataIPv4PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectDataIPv4PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectDataIPv4PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectDataIPv4PrefixListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..b6b1abef
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_ipv4_prefix_list_profile_parcel_test.go
@@ -0,0 +1,78 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectDataIPv4PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectDataIPv4PrefixListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectDataIPv4PrefixListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectDataIPv4PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectDataIPv4PrefixListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_data_ipv4_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..10cebe1d
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.go
@@ -0,0 +1,261 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectDataIPv6PrefixListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectDataIPv6PrefixListProfileParcelResource{}
+
+func NewPolicyObjectDataIPv6PrefixListProfileParcelResource() resource.Resource {
+ return &PolicyObjectDataIPv6PrefixListProfileParcelResource{}
+}
+
+type PolicyObjectDataIPv6PrefixListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_ipv6_prefix_list_profile_parcel"
+}
+
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Data IPv6 Prefix List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 address").String,
+ Optional: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix").AddIntegerRangeDescription(0, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(128),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectDataIPv6PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectDataIPv6PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectDataIPv6PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectDataIPv6PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectDataIPv6PrefixListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..5cc9de70
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_list_profile_parcel_test.go
@@ -0,0 +1,79 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectDataIPv6PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectDataIPv6PrefixListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectDataIPv6PrefixListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectDataIPv6PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectDataIPv6PrefixListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_data_ipv6_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go
new file mode 100644
index 00000000..20c72c10
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel.go
@@ -0,0 +1,261 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectDataIPv6PrefixProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectDataIPv6PrefixProfileParcelResource{}
+
+func NewPolicyObjectDataIPv6PrefixProfileParcelResource() resource.Resource {
+ return &PolicyObjectDataIPv6PrefixProfileParcelResource{}
+}
+
+type PolicyObjectDataIPv6PrefixProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_ipv6_prefix_profile_parcel"
+}
+
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Data IPv6 Prefix profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 address").String,
+ Optional: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix").AddIntegerRangeDescription(0, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(128),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectDataIPv6Prefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectDataIPv6Prefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectDataIPv6Prefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectDataIPv6Prefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectDataIPv6PrefixProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..01ab354c
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_ipv6_prefix_profile_parcel_test.go
@@ -0,0 +1,88 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectDataIPv6PrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectDataIPv6PrefixProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_data_ipv6_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel.go
new file mode 100644
index 00000000..1b06035f
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel.go
@@ -0,0 +1,261 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectDataPrefixProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectDataPrefixProfileParcelResource{}
+
+func NewPolicyObjectDataPrefixProfileParcelResource() resource.Resource {
+ return &PolicyObjectDataPrefixProfileParcelResource{}
+}
+
+type PolicyObjectDataPrefixProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectDataPrefixProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_data_prefix_profile_parcel"
+}
+
+func (r *PolicyObjectDataPrefixProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Data Prefix profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 Data Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 address").String,
+ Optional: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix Length").AddIntegerRangeDescription(0, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(32),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectDataPrefixProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectDataPrefixProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectDataPrefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectDataPrefixProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectDataPrefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectDataPrefixProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectDataPrefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectDataPrefixProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectDataPrefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectDataPrefixProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..938ec967
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_data_prefix_profile_parcel_test.go
@@ -0,0 +1,88 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectDataPrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_data_prefix_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_data_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectDataPrefixProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_data_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_expanded_community_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_expanded_community_list_profile_parcel.go
new file mode 100644
index 00000000..90e62439
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_expanded_community_list_profile_parcel.go
@@ -0,0 +1,249 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectExpandedCommunityListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectExpandedCommunityListProfileParcelResource{}
+
+func NewPolicyObjectExpandedCommunityListProfileParcelResource() resource.Resource {
+ return &PolicyObjectExpandedCommunityListProfileParcelResource{}
+}
+
+type PolicyObjectExpandedCommunityListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_expanded_community_list_profile_parcel"
+}
+
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Expanded Community List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "expanded_community_lists": schema.SetAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Expanded Community List").String,
+ ElementType: types.StringType,
+ Required: true,
+ },
+ "expanded_community_lists_variable": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
+ Optional: true,
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectExpandedCommunityList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectExpandedCommunityList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectExpandedCommunityList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectExpandedCommunityList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectExpandedCommunityListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_expanded_community_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_expanded_community_list_profile_parcel_test.go
new file mode 100644
index 00000000..f0bf59b6
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_expanded_community_list_profile_parcel_test.go
@@ -0,0 +1,74 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectExpandedCommunityListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectExpandedCommunityListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectExpandedCommunityListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectExpandedCommunityListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectExpandedCommunityListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_expanded_community_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` expanded_community_lists = ["abcd"]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel.go
new file mode 100644
index 00000000..6191d06a
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel.go
@@ -0,0 +1,249 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectExpandedCommunityProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectExpandedCommunityProfileParcelResource{}
+
+func NewPolicyObjectExpandedCommunityProfileParcelResource() resource.Resource {
+ return &PolicyObjectExpandedCommunityProfileParcelResource{}
+}
+
+type PolicyObjectExpandedCommunityProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_expanded_community_profile_parcel"
+}
+
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Expanded Community profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "expanded_community_lists": schema.SetAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Expanded Community List").String,
+ ElementType: types.StringType,
+ Required: true,
+ },
+ "expanded_community_lists_variable": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Variable name").String,
+ Optional: true,
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectExpandedCommunity
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectExpandedCommunity
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectExpandedCommunity
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectExpandedCommunity
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectExpandedCommunityProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel_test.go
new file mode 100644
index 00000000..3e515b55
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_expanded_community_profile_parcel_test.go
@@ -0,0 +1,80 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectExpandedCommunityProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_expanded_community_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` expanded_community_lists = ["abcd"]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectExpandedCommunityProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_expanded_community_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` expanded_community_lists = ["abcd"]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_extended_community_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_extended_community_list_profile_parcel.go
new file mode 100644
index 00000000..dfe180a4
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_extended_community_list_profile_parcel.go
@@ -0,0 +1,258 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "regexp"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectExtendedCommunityListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectExtendedCommunityListProfileParcelResource{}
+
+func NewPolicyObjectExtendedCommunityListProfileParcelResource() resource.Resource {
+ return &PolicyObjectExtendedCommunityListProfileParcelResource{}
+}
+
+type PolicyObjectExtendedCommunityListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_extended_community_list_profile_parcel"
+}
+
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Extended Community List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Extended Community List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "extended_community": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("can be soo 10.0.0.1:30 or rt 500:50 etc.").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.RegexMatches(regexp.MustCompile(`^(rt|soo) ([\d\.]+):(\d+)$`), ""),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectExtendedCommunityList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectExtendedCommunityList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectExtendedCommunityList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectExtendedCommunityList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectExtendedCommunityListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_extended_community_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_extended_community_list_profile_parcel_test.go
new file mode 100644
index 00000000..cdf65f4e
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_extended_community_list_profile_parcel_test.go
@@ -0,0 +1,77 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectExtendedCommunityListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_extended_community_list_profile_parcel.test", "entries.0.extended_community", "soo 10.0.0.1:30"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectExtendedCommunityListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectExtendedCommunityListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectExtendedCommunityListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectExtendedCommunityListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_extended_community_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` extended_community = "soo 10.0.0.1:30"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel.go
new file mode 100644
index 00000000..8d880d00
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel.go
@@ -0,0 +1,258 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "regexp"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectExtendedCommunityProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectExtendedCommunityProfileParcelResource{}
+
+func NewPolicyObjectExtendedCommunityProfileParcelResource() resource.Resource {
+ return &PolicyObjectExtendedCommunityProfileParcelResource{}
+}
+
+type PolicyObjectExtendedCommunityProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_extended_community_profile_parcel"
+}
+
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Extended Community profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Extended Community List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "extended_community": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("can be soo 10.0.0.1:30 or rt 500:50 etc.").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.RegexMatches(regexp.MustCompile(`^(rt|soo) ([\d\.]+):(\d+)$`), ""),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectExtendedCommunity
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectExtendedCommunity
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectExtendedCommunity
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectExtendedCommunity
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectExtendedCommunityProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel_test.go
new file mode 100644
index 00000000..c7004d5e
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_extended_community_profile_parcel_test.go
@@ -0,0 +1,85 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectExtendedCommunityProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_extended_community_profile_parcel.test", "entries.0.extended_community", "soo 10.0.0.1:30"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_extended_community_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` extended_community = "soo 10.0.0.1:30"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectExtendedCommunityProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_extended_community_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` extended_community = "soo 10.0.0.1:30"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_feature_profile.go b/internal/provider/resource_sdwan_policy_object_feature_profile.go
new file mode 100644
index 00000000..ee1650c0
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_feature_profile.go
@@ -0,0 +1,236 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "strings"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectFeatureProfileResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectFeatureProfileResource{}
+
+func NewPolicyObjectFeatureProfileResource() resource.Resource {
+ return &PolicyObjectFeatureProfileResource{}
+}
+
+type PolicyObjectFeatureProfileResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectFeatureProfileResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_feature_profile"
+}
+
+func (r *PolicyObjectFeatureProfileResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Feature Profile .").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the object",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("The name of the policy object feature profile").String,
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Description").String,
+ Required: true,
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectFeatureProfileResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectFeatureProfileResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectFeatureProfile
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+ plan.Id = types.StringValue(res.Get("id").String())
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectFeatureProfileResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectFeatureProfile
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString()))
+ if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ state.fromBody(ctx, res)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectFeatureProfileResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectFeatureProfile
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ if plan.hasChanges(ctx, &state) {
+ body := plan.toBody(ctx)
+ r.updateMutex.Lock()
+ res, err := r.client.Put(plan.getPath()+url.QueryEscape(plan.Id.ValueString()), body)
+ r.updateMutex.Unlock()
+ if err != nil {
+ if strings.Contains(res.Get("error.message").String(), "Failed to acquire lock") {
+ resp.Diagnostics.AddWarning("Client Warning", "Failed to modify policy due to policy being locked by another change. Policy changes will not be applied. Re-run 'terraform apply' to try again.")
+ } else if strings.Contains(res.Get("error.message").String(), "Template locked in edit mode") {
+ resp.Diagnostics.AddWarning("Client Warning", "Failed to modify template due to template being locked by another change. Template changes will not be applied. Re-run 'terraform apply' to try again.")
+ } else {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+ }
+ } else {
+ tflog.Debug(ctx, fmt.Sprintf("%s: No changes detected", plan.Name.ValueString()))
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectFeatureProfileResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectFeatureProfile
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + url.QueryEscape(state.Id.ValueString()))
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_feature_profile_test.go b/internal/provider/resource_sdwan_policy_object_feature_profile_test.go
new file mode 100644
index 00000000..70ad8ac1
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_feature_profile_test.go
@@ -0,0 +1,64 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectFeatureProfile(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_feature_profile.test", "name", "POLICY_OBJECT_FP_1"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_feature_profile.test", "description", "My policy object feature profile 1"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectFeatureProfileConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectFeatureProfileConfig_all() string {
+ config := `resource "sdwan_policy_object_feature_profile" "test" {` + "\n"
+ config += ` name = "POLICY_OBJECT_FP_1"` + "\n"
+ config += ` description = "My policy object feature profile 1"` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..cbb329d8
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_ipv4_prefix_list_profile_parcel.go
@@ -0,0 +1,275 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectIPv4PrefixListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectIPv4PrefixListProfileParcelResource{}
+
+func NewPolicyObjectIPv4PrefixListProfileParcelResource() resource.Resource {
+ return &PolicyObjectIPv4PrefixListProfileParcelResource{}
+}
+
+type PolicyObjectIPv4PrefixListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_ipv4_prefix_list_profile_parcel"
+}
+
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object IPv4 Prefix List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 address").String,
+ Optional: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix length").AddIntegerRangeDescription(0, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(32),
+ },
+ },
+ "le": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix length with le range operator").AddIntegerRangeDescription(1, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 32),
+ },
+ },
+ "ge": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix length with ge range operator").AddIntegerRangeDescription(1, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 32),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectIPv4PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectIPv4PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectIPv4PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectIPv4PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectIPv4PrefixListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_ipv4_prefix_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_ipv4_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..32abf69a
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_ipv4_prefix_list_profile_parcel_test.go
@@ -0,0 +1,98 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectIPv4PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.le", "24"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv4_prefix_list_profile_parcel.test", "entries.0.ge", "16"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectIPv4PrefixListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectIPv4PrefixListProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectIPv4PrefixListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectIPv4PrefixListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectIPv4PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectIPv4PrefixListProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` le = 24` + "\n"
+ config += ` ge = 16` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectIPv4PrefixListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_ipv4_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` le = 24` + "\n"
+ config += ` ge = 16` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go
new file mode 100644
index 00000000..caf498c0
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_list_profile_parcel.go
@@ -0,0 +1,275 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectIPv6PrefixListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectIPv6PrefixListProfileParcelResource{}
+
+func NewPolicyObjectIPv6PrefixListProfileParcelResource() resource.Resource {
+ return &PolicyObjectIPv6PrefixListProfileParcelResource{}
+}
+
+type PolicyObjectIPv6PrefixListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_ipv6_prefix_list_profile_parcel"
+}
+
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object IPv6 Prefix List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 address").String,
+ Optional: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix length").AddIntegerRangeDescription(0, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(128),
+ },
+ },
+ "le": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix length with le range operator").AddIntegerRangeDescription(1, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 128),
+ },
+ },
+ "ge": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix length with ge range operator").AddIntegerRangeDescription(1, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 128),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectIPv6PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectIPv6PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectIPv6PrefixList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectIPv6PrefixList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectIPv6PrefixListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_ipv6_prefix_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_list_profile_parcel_test.go
new file mode 100644
index 00000000..a936e2af
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_list_profile_parcel_test.go
@@ -0,0 +1,99 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectIPv6PrefixListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.le", "100"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_list_profile_parcel.test", "entries.0.ge", "70"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectIPv6PrefixListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectIPv6PrefixListProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectIPv6PrefixListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectIPv6PrefixListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectIPv6PrefixListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectIPv6PrefixListProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` le = 100` + "\n"
+ config += ` ge = 70` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectIPv6PrefixListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_ipv6_prefix_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` le = 100` + "\n"
+ config += ` ge = 70` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel.go
new file mode 100644
index 00000000..364960b1
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel.go
@@ -0,0 +1,275 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectIPv6PrefixProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectIPv6PrefixProfileParcelResource{}
+
+func NewPolicyObjectIPv6PrefixProfileParcelResource() resource.Resource {
+ return &PolicyObjectIPv6PrefixProfileParcelResource{}
+}
+
+type PolicyObjectIPv6PrefixProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_ipv6_prefix_profile_parcel"
+}
+
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object IPv6 Prefix profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv6_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 address").String,
+ Optional: true,
+ },
+ "ipv6_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix length").AddIntegerRangeDescription(0, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(128),
+ },
+ },
+ "le_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix length with le range operator").AddIntegerRangeDescription(1, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 128),
+ },
+ },
+ "ge_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv6 prefix length with ge range operator").AddIntegerRangeDescription(1, 128).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 128),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectIPv6Prefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectIPv6Prefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectIPv6Prefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectIPv6Prefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectIPv6PrefixProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..f0e83b78
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_ipv6_prefix_profile_parcel_test.go
@@ -0,0 +1,94 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectIPv6PrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_address", "2001:db8:85a3::8a2e:370:7334"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ipv6_prefix_length", "64"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.le_range_prefix_length", "100"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_ipv6_prefix_profile_parcel.test", "entries.0.ge_range_prefix_length", "70"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` le_range_prefix_length = 100` + "\n"
+ config += ` ge_range_prefix_length = 70` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectIPv6PrefixProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_ipv6_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv6_address = "2001:db8:85a3::8a2e:370:7334"` + "\n"
+ config += ` ipv6_prefix_length = 64` + "\n"
+ config += ` le_range_prefix_length = 100` + "\n"
+ config += ` ge_range_prefix_length = 70` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel.go
new file mode 100644
index 00000000..d3b7db3b
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel.go
@@ -0,0 +1,256 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectMirrorProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectMirrorProfileParcelResource{}
+
+func NewPolicyObjectMirrorProfileParcelResource() resource.Resource {
+ return &PolicyObjectMirrorProfileParcelResource{}
+}
+
+type PolicyObjectMirrorProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectMirrorProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_mirror_profile_parcel"
+}
+
+func (r *PolicyObjectMirrorProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Mirror profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Mirror List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "remote_destination_ip": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("remote destination ip address").String,
+ Optional: true,
+ },
+ "source_ip": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("source ip address").String,
+ Optional: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectMirrorProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectMirrorProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectMirror
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectMirrorProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectMirror
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectMirrorProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectMirror
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectMirrorProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectMirror
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectMirrorProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel_test.go
new file mode 100644
index 00000000..dc6c1a9b
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_mirror_profile_parcel_test.go
@@ -0,0 +1,78 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectMirrorProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_mirror_profile_parcel.test", "entries.0.remote_destination_ip", "10.0.0.1"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_mirror_profile_parcel.test", "entries.0.source_ip", "10.0.0.2"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectMirrorProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectMirrorPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectMirrorProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_mirror_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` remote_destination_ip = "10.0.0.1"` + "\n"
+ config += ` source_ip = "10.0.0.2"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_policer_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_policer_profile_parcel.go
new file mode 100644
index 00000000..ea7bf104
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_policer_profile_parcel.go
@@ -0,0 +1,272 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectPolicerProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectPolicerProfileParcelResource{}
+
+func NewPolicyObjectPolicerProfileParcelResource() resource.Resource {
+ return &PolicyObjectPolicerProfileParcelResource{}
+}
+
+type PolicyObjectPolicerProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectPolicerProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_policer_profile_parcel"
+}
+
+func (r *PolicyObjectPolicerProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Policer profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Policer Entries").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "burst_bytes": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Burst (Bytes)").AddIntegerRangeDescription(15000, 10000000).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(15000, 10000000),
+ },
+ },
+ "exceed_action": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Exceed options such as Drop or Remark").AddStringEnumDescription("drop", "remark").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("drop", "remark"),
+ },
+ },
+ "rate_bps": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Rate (bps)").AddIntegerRangeDescription(8, 100000000000).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(8, 100000000000),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectPolicerProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectPolicerProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectPolicer
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectPolicerProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectPolicer
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectPolicerProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectPolicer
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectPolicerProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectPolicer
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectPolicerProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_policer_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_policer_profile_parcel_test.go
new file mode 100644
index 00000000..6cedcc13
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_policer_profile_parcel_test.go
@@ -0,0 +1,81 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectPolicerProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_policer_profile_parcel.test", "entries.0.burst_bytes", "56500"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_policer_profile_parcel.test", "entries.0.exceed_action", "remark"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_policer_profile_parcel.test", "entries.0.rate_bps", "60000"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectPolicerProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectPolicerPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectPolicerProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_policer_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` burst_bytes = 56500` + "\n"
+ config += ` exceed_action = "remark"` + "\n"
+ config += ` rate_bps = 60000` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel.go
new file mode 100644
index 00000000..f016c98b
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel.go
@@ -0,0 +1,275 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectPrefixProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectPrefixProfileParcelResource{}
+
+func NewPolicyObjectPrefixProfileParcelResource() resource.Resource {
+ return &PolicyObjectPrefixProfileParcelResource{}
+}
+
+type PolicyObjectPrefixProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectPrefixProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_prefix_profile_parcel"
+}
+
+func (r *PolicyObjectPrefixProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object Prefix profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 Prefix List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "ipv4_address": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 address").String,
+ Optional: true,
+ },
+ "ipv4_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix length").AddIntegerRangeDescription(0, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.AtMost(32),
+ },
+ },
+ "le_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix length with le range operator").AddIntegerRangeDescription(1, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 32),
+ },
+ },
+ "ge_range_prefix_length": schema.Int64Attribute{
+ MarkdownDescription: helpers.NewAttributeDescription("IPv4 prefix length with ge range operator").AddIntegerRangeDescription(1, 32).String,
+ Optional: true,
+ Validators: []validator.Int64{
+ int64validator.Between(1, 32),
+ },
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectPrefixProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectPrefixProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectPrefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectPrefixProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectPrefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectPrefixProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectPrefix
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectPrefixProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectPrefix
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectPrefixProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel_test.go
new file mode 100644
index 00000000..8e96ef08
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_prefix_profile_parcel_test.go
@@ -0,0 +1,94 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectPrefixProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ipv4_address", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ipv4_prefix_length", "8"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_prefix_profile_parcel.test", "entries.0.le_range_prefix_length", "24"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_prefix_profile_parcel.test", "entries.0.ge_range_prefix_length", "16"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectPrefixProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectPrefixProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectPrefixProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` le_range_prefix_length = 24` + "\n"
+ config += ` ge_range_prefix_length = 16` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectPrefixProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_prefix_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` ipv4_address = "10.0.0.0"` + "\n"
+ config += ` ipv4_prefix_length = 8` + "\n"
+ config += ` le_range_prefix_length = 24` + "\n"
+ config += ` ge_range_prefix_length = 16` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_tloc_list_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_tloc_list_profile_parcel.go
new file mode 100644
index 00000000..4056cbcb
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_tloc_list_profile_parcel.go
@@ -0,0 +1,272 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectTLOCListProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectTLOCListProfileParcelResource{}
+
+func NewPolicyObjectTLOCListProfileParcelResource() resource.Resource {
+ return &PolicyObjectTLOCListProfileParcelResource{}
+}
+
+type PolicyObjectTLOCListProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectTLOCListProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_tloc_list_profile_parcel"
+}
+
+func (r *PolicyObjectTLOCListProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object TLOC List profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("TLOC List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "tloc_ip": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("tloc").String,
+ Optional: true,
+ },
+ "color": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("color").AddStringEnumDescription("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver"),
+ },
+ },
+ "encapsulation": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("encapsulation").AddStringEnumDescription("ipsec", "gre").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("ipsec", "gre"),
+ },
+ },
+ "preference": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Preference").String,
+ Optional: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectTLOCListProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectTLOCListProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectTLOCList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectTLOCListProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectTLOCList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectTLOCListProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectTLOCList
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectTLOCListProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectTLOCList
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectTLOCListProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_tloc_list_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_tloc_list_profile_parcel_test.go
new file mode 100644
index 00000000..40694360
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_tloc_list_profile_parcel_test.go
@@ -0,0 +1,83 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectTLOCListProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("TF_VAR_policy_object_feature_template_id") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or TF_VAR_policy_object_feature_template_id")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.tloc_ip", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.color", "3g"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.encapsulation", "gre"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_list_profile_parcel.test", "entries.0.preference", "33"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+
+ {
+ Config: testAccSdwanPolicyObjectTLOCListPrerequisitesProfileParcelConfig + testAccSdwanPolicyObjectTLOCListProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+const testAccSdwanPolicyObjectTLOCListPrerequisitesProfileParcelConfig = `
+variable "policy_object_feature_template_id" {}
+
+`
+
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectTLOCListProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_tloc_list_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = var.policy_object_feature_template_id` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` tloc_ip = "10.0.0.0"` + "\n"
+ config += ` color = "3g"` + "\n"
+ config += ` encapsulation = "gre"` + "\n"
+ config += ` preference = "33"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel.go b/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel.go
new file mode 100644
index 00000000..4a1446a7
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel.go
@@ -0,0 +1,272 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "sync"
+
+ "github.com/CiscoDevNet/terraform-provider-sdwan/internal/provider/helpers"
+ "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
+ "github.com/hashicorp/terraform-plugin-framework/path"
+ "github.com/hashicorp/terraform-plugin-framework/resource"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
+ "github.com/hashicorp/terraform-plugin-framework/schema/validator"
+ "github.com/hashicorp/terraform-plugin-framework/types"
+ "github.com/hashicorp/terraform-plugin-log/tflog"
+ "github.com/netascode/go-sdwan"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin model
+
+// Ensure provider defined types fully satisfy framework interfaces
+var _ resource.Resource = &PolicyObjectTLOCProfileParcelResource{}
+var _ resource.ResourceWithImportState = &PolicyObjectTLOCProfileParcelResource{}
+
+func NewPolicyObjectTLOCProfileParcelResource() resource.Resource {
+ return &PolicyObjectTLOCProfileParcelResource{}
+}
+
+type PolicyObjectTLOCProfileParcelResource struct {
+ client *sdwan.Client
+ updateMutex *sync.Mutex
+}
+
+func (r *PolicyObjectTLOCProfileParcelResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
+ resp.TypeName = req.ProviderTypeName + "_policy_object_tloc_profile_parcel"
+}
+
+func (r *PolicyObjectTLOCProfileParcelResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
+ resp.Schema = schema.Schema{
+ // This description is used by the documentation generator and the language server.
+ MarkdownDescription: helpers.NewAttributeDescription("This resource can manage a Policy Object TLOC profile parcel.").AddMinimumVersionDescription("20.12.0").String,
+
+ Attributes: map[string]schema.Attribute{
+ "id": schema.StringAttribute{
+ MarkdownDescription: "The id of the profile parcel",
+ Computed: true,
+ PlanModifiers: []planmodifier.String{
+ stringplanmodifier.UseStateForUnknown(),
+ },
+ },
+ "version": schema.Int64Attribute{
+ MarkdownDescription: "The version of the profile parcel",
+ Computed: true,
+ },
+ "name": schema.StringAttribute{
+ MarkdownDescription: "The name of the profile parcel",
+ Required: true,
+ },
+ "description": schema.StringAttribute{
+ MarkdownDescription: "The description of the profile parcel",
+ Optional: true,
+ },
+ "feature_profile_id": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Feature Profile ID").String,
+ Required: true,
+ },
+ "entries": schema.ListNestedAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("TLOC List").String,
+ Required: true,
+ NestedObject: schema.NestedAttributeObject{
+ Attributes: map[string]schema.Attribute{
+ "tloc": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("tloc").String,
+ Optional: true,
+ },
+ "color": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("color").AddStringEnumDescription("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("3g", "biz-internet", "blue", "bronze", "custom1", "custom2", "custom3", "default", "gold", "green", "lte", "metro-ethernet", "mpls", "private1", "private2", "private3", "private4", "private5", "private6", "public-internet", "red", "silver"),
+ },
+ },
+ "encapsulation": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("encapsulation").AddStringEnumDescription("ipsec", "gre").String,
+ Optional: true,
+ Validators: []validator.String{
+ stringvalidator.OneOf("ipsec", "gre"),
+ },
+ },
+ "preference": schema.StringAttribute{
+ MarkdownDescription: helpers.NewAttributeDescription("Preference").String,
+ Optional: true,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func (r *PolicyObjectTLOCProfileParcelResource) Configure(_ context.Context, req resource.ConfigureRequest, _ *resource.ConfigureResponse) {
+ if req.ProviderData == nil {
+ return
+ }
+
+ r.client = req.ProviderData.(*SdwanProviderData).Client
+ r.updateMutex = req.ProviderData.(*SdwanProviderData).UpdateMutex
+}
+
+// End of section. //template:end model
+
+// Section below is generated&owned by "gen/generator.go". //template:begin create
+func (r *PolicyObjectTLOCProfileParcelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
+ var plan PolicyObjectTLOC
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Name.ValueString()))
+
+ // Create object
+ body := plan.toBody(ctx)
+
+ res, err := r.client.Post(plan.getPath(), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (POST), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Id = types.StringValue(res.Get("parcelId").String())
+ plan.Version = types.Int64Value(0)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Create finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end create
+
+// Section below is generated&owned by "gen/generator.go". //template:begin read
+func (r *PolicyObjectTLOCProfileParcelResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
+ var state PolicyObjectTLOC
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String()))
+
+ res, err := r.client.Get(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if res.Get("error.message").String() == "Invalid feature Id" {
+ resp.State.RemoveResource(ctx)
+ return
+ } else if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes
+ if state.isNull(ctx, res) {
+ state.fromBody(ctx, res)
+ } else {
+ state.updateFromBody(ctx, res)
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end read
+
+// Section below is generated&owned by "gen/generator.go". //template:begin update
+func (r *PolicyObjectTLOCProfileParcelResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
+ var plan, state PolicyObjectTLOC
+
+ // Read plan
+ diags := req.Plan.Get(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+ // Read state
+ diags = req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Name.ValueString()))
+
+ body := plan.toBody(ctx)
+ res, err := r.client.Put(plan.getPath()+"/"+url.QueryEscape(plan.Id.ValueString()), body)
+ if err != nil {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ plan.Version = types.Int64Value(state.Version.ValueInt64() + 1)
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Update finished successfully", plan.Name.ValueString()))
+
+ diags = resp.State.Set(ctx, &plan)
+ resp.Diagnostics.Append(diags...)
+}
+
+// End of section. //template:end update
+
+// Section below is generated&owned by "gen/generator.go". //template:begin delete
+func (r *PolicyObjectTLOCProfileParcelResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
+ var state PolicyObjectTLOC
+
+ // Read state
+ diags := req.State.Get(ctx, &state)
+ resp.Diagnostics.Append(diags...)
+ if resp.Diagnostics.HasError() {
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Name.ValueString()))
+
+ res, err := r.client.Delete(state.getPath() + "/" + url.QueryEscape(state.Id.ValueString()))
+ if err != nil && res.Get("error.message").String() != "Invalid Template Id" {
+ resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to delete object (DELETE), got error: %s, %s", err, res.String()))
+ return
+ }
+
+ tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Name.ValueString()))
+
+ resp.State.RemoveResource(ctx)
+}
+
+// End of section. //template:end delete
+
+// Section below is generated&owned by "gen/generator.go". //template:begin import
+func (r *PolicyObjectTLOCProfileParcelResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
+ resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)
+}
+
+// End of section. //template:end import
diff --git a/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel_test.go b/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel_test.go
new file mode 100644
index 00000000..a0680713
--- /dev/null
+++ b/internal/provider/resource_sdwan_policy_object_tloc_profile_parcel_test.go
@@ -0,0 +1,94 @@
+// Copyright © 2023 Cisco Systems, Inc. and its affiliates.
+// All rights reserved.
+//
+// Licensed under the Mozilla Public License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://mozilla.org/MPL/2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// SPDX-License-Identifier: MPL-2.0
+
+package provider
+
+// Section below is generated&owned by "gen/generator.go". //template:begin imports
+import (
+ "os"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-testing/helper/resource"
+)
+
+// End of section. //template:end imports
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAcc
+func TestAccSdwanPolicyObjectTLOCProfileParcel(t *testing.T) {
+ if os.Getenv("SDWAN_2012") == "" && os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") == "" {
+ t.Skip("skipping test, set environment variable SDWAN_2012 or POLICY_OBJECT_FEATURE_TEMPLATE_ID")
+ }
+ var checks []resource.TestCheckFunc
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_profile_parcel.test", "entries.0.tloc", "10.0.0.0"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_profile_parcel.test", "entries.0.color", "3g"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_profile_parcel.test", "entries.0.encapsulation", "gre"))
+ checks = append(checks, resource.TestCheckResourceAttr("sdwan_policy_object_tloc_profile_parcel.test", "entries.0.preference", "33"))
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
+ Steps: []resource.TestStep{
+ {
+ Config: testAccSdwanPolicyObjectTLOCProfileParcelConfig_minimum(),
+ },
+ {
+ Config: testAccSdwanPolicyObjectTLOCProfileParcelConfig_all(),
+ Check: resource.ComposeTestCheckFunc(checks...),
+ },
+ },
+ })
+}
+
+// End of section. //template:end testAcc
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testPrerequisites
+// End of section. //template:end testPrerequisites
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigMinimum
+func testAccSdwanPolicyObjectTLOCProfileParcelConfig_minimum() string {
+ config := `resource "sdwan_policy_object_tloc_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_MIN"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` tloc = "10.0.0.0"` + "\n"
+ config += ` color = "3g"` + "\n"
+ config += ` encapsulation = "gre"` + "\n"
+ config += ` preference = "33"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigMinimum
+
+// Section below is generated&owned by "gen/generator.go". //template:begin testAccConfigAll
+func testAccSdwanPolicyObjectTLOCProfileParcelConfig_all() string {
+ config := `resource "sdwan_policy_object_tloc_profile_parcel" "test" {` + "\n"
+ config += ` name = "TF_TEST_ALL"` + "\n"
+ config += ` description = "Terraform integration test"` + "\n"
+ config += ` feature_profile_id = ` + "\"" + os.Getenv("POLICY_OBJECT_FEATURE_TEMPLATE_ID") + "\"" + `` + "\n"
+ config += ` entries = [{` + "\n"
+ config += ` tloc = "10.0.0.0"` + "\n"
+ config += ` color = "3g"` + "\n"
+ config += ` encapsulation = "gre"` + "\n"
+ config += ` preference = "33"` + "\n"
+ config += ` }]` + "\n"
+ config += `}` + "\n"
+ return config
+}
+
+// End of section. //template:end testAccConfigAll
diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl
index 9fc4e20f..18fd3f3b 100644
--- a/templates/guides/changelog.md.tmpl
+++ b/templates/guides/changelog.md.tmpl
@@ -21,6 +21,18 @@ description: |-
- BREAKING CHANGE: Rename `aaa_derive_name_identity` attribute of `sdwan_system_remote_access_profile_parcel` resource to `aaa_derive_name_from_peer_identity`
- BREAKING CHANGE: Rename `aaa_derive_name_domain` attribute of `sdwan_system_remote_access_profile_parcel` resource to `aaa_derive_name_from_peer_domain`
- BREAKING CHANGE: Removes `any_connect_eap_profile_download_status` and `any_connect_eap_profile_file_name` attributes of `sdwan_system_remote_access_profile_parcel
+- Add `sdwan_policy_object_feature_profile` resource and data source
+- Add `sdwan_policy_object_class_map_profile_parcel` resource and data source
+- Add `sdwan_policy_object_color_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_data_ipv6_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_data_ipv4_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_tloc_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_expanded_community_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_extended_community_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_mirror_profile_parcel` resource and data source
+- Add `sdwan_policy_object_policer_profile_parcel` resource and data source
+- Add `sdwan_policy_object_ipv4_prefix_list_profile_parcel` resource and data source
+- Add `sdwan_policy_object_ipv6_prefix_list_profile_parcel` resource and data source
## 0.3.13