diff --git a/docs/data-sources/annotation.md b/docs/data-sources/annotation.md index 8a28ab9f1..b421b2c3e 100644 --- a/docs/data-sources/annotation.md +++ b/docs/data-sources/annotation.md @@ -55,25 +55,25 @@ data "aci_annotation" "example_application_epg" { * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) + - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) + - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) - [aci_l3_outside](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) ([l3extOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extOut/overview)) - [aci_l3out_provider_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_provider_label) ([l3extProvLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extProvLbl/overview)) - [aci_logical_node_to_fabric_node](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_to_fabric_node) ([l3extRsNodeL3OutAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsNodeL3OutAtt/overview)) - - [aci_relation_to_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_fallback_route_group) ([l3extRsOutToFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsOutToFBRGroup/overview)) - - [aci_l3out_redistribute_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_redistribute_policy) ([l3extRsRedistributePol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsRedistributePol/overview)) - - [aci_external_management_network_instance_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_instance_profile) ([mgmtInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtInstP/overview)) - - [aci_relation_to_consumed_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_out_of_band_contract) ([mgmtRsOoBCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtRsOoBCons/overview)) - - [aci_external_management_network_subnet](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_subnet) ([mgmtSubnet](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtSubnet/overview)) - - [aci_l3out_node_sid_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_node_sid_profile) ([mplsNodeSidP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mplsNodeSidP/overview)) - - [aci_netflow_exporter_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_exporter_policy) ([netflowExporterPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowExporterPol/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/data-sources/endpoint_tag_ip.md b/docs/data-sources/endpoint_tag_ip.md index 92bd7d66a..301cbf68c 100644 --- a/docs/data-sources/endpoint_tag_ip.md +++ b/docs/data-sources/endpoint_tag_ip.md @@ -7,12 +7,12 @@ layout: "aci" page_title: "ACI: aci_endpoint_tag_ip" sidebar_current: "docs-aci-data-source-aci_endpoint_tag_ip" description: |- - Data source for Endpoint Tag Ip + Data source for Endpoint Tag IP --- # aci_endpoint_tag_ip # -Data source for Endpoint Tag Ip +Data source for Endpoint Tag IP ## API Information ## @@ -44,16 +44,16 @@ data "aci_endpoint_tag_ip" "example_tenant" { * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) -* `vrf_name` (ctxName) - (string) The VRF name of the Endpoint Tag Ip object. -* `ip` (ip) - (string) The IP address of the Endpoint Tag Ip object. +* `vrf_name` (ctxName) - (string) The VRF name of the Endpoint Tag IP object. +* `ip` (ip) - (string) The IP address of the Endpoint Tag IP object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the Endpoint Tag Ip object. -* `annotation` (annotation) - (string) The annotation of the Endpoint Tag Ip object. -* `id_attribute` (id) - (string) The identifier of the Endpoint Tag Ip object. -* `name` (name) - (string) The name of the Endpoint Tag Ip object. -* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag Ip object. +* `id` - (string) The distinguished name (DN) of the Endpoint Tag IP object. +* `annotation` (annotation) - (string) The annotation of the Endpoint Tag IP object. +* `id_attribute` (id) - (string) The identifier of the Endpoint Tag IP object. +* `name` (name) - (string) The name of the Endpoint Tag IP object. +* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag IP object. * `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. * `key` (key) - (string) The key used to uniquely identify this configuration object. diff --git a/docs/data-sources/endpoint_tag_mac.md b/docs/data-sources/endpoint_tag_mac.md index 65de071a0..8e1dc044d 100644 --- a/docs/data-sources/endpoint_tag_mac.md +++ b/docs/data-sources/endpoint_tag_mac.md @@ -7,12 +7,12 @@ layout: "aci" page_title: "ACI: aci_endpoint_tag_mac" sidebar_current: "docs-aci-data-source-aci_endpoint_tag_mac" description: |- - Data source for Endpoint Tag Mac + Data source for Endpoint Tag MAC --- # aci_endpoint_tag_mac # -Data source for Endpoint Tag Mac +Data source for Endpoint Tag MAC ## API Information ## @@ -44,16 +44,16 @@ data "aci_endpoint_tag_mac" "example_tenant" { * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) -* `bd_name` (bdName) - (string) The bridge domain name of the Endpoint Tag Mac object. -* `mac` (mac) - (string) The MAC address of the Endpoint Tag Mac object. +* `bd_name` (bdName) - (string) The bridge domain name of the Endpoint Tag MAC object. +* `mac` (mac) - (string) The MAC address of the Endpoint Tag MAC object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the Endpoint Tag Mac object. -* `annotation` (annotation) - (string) The annotation of the Endpoint Tag Mac object. -* `id_attribute` (id) - (string) The identifier of the Endpoint Tag Mac object. -* `name` (name) - (string) The name of the Endpoint Tag Mac object. -* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag Mac object. +* `id` - (string) The distinguished name (DN) of the Endpoint Tag MAC object. +* `annotation` (annotation) - (string) The annotation of the Endpoint Tag MAC object. +* `id_attribute` (id) - (string) The identifier of the Endpoint Tag MAC object. +* `name` (name) - (string) The name of the Endpoint Tag MAC object. +* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag MAC object. * `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. * `key` (key) - (string) The key used to uniquely identify this configuration object. diff --git a/docs/data-sources/epg_useg_criterion.md b/docs/data-sources/epg_useg_criterion.md new file mode 100644 index 000000000..efa84414f --- /dev/null +++ b/docs/data-sources/epg_useg_criterion.md @@ -0,0 +1,65 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion" +sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion" +description: |- + Data source for EPG uSeg Criterion +--- + +# aci_epg_useg_criterion # + +Data source for EPG uSeg Criterion + +## API Information ## + +* Class: [fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +```hcl + +data "aci_epg_useg_criterion" "example_application_epg" { + parent_dn = aci_application_epg.example.id +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion object. +* `description` (descr) - (string) The description of the EPG uSeg Criterion object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Criterion object. +* `name` (name) - (string) The name of the EPG uSeg Criterion object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `precedence` (prec) - (string) The precedence of the EPG uSeg Criterion object. +* `scope` (scope) - (string) The scope of the EPG uSeg Criterion object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/epg_useg_criterion_dns_attribute.md b/docs/data-sources/epg_useg_criterion_dns_attribute.md new file mode 100644 index 000000000..2aeb72480 --- /dev/null +++ b/docs/data-sources/epg_useg_criterion_dns_attribute.md @@ -0,0 +1,64 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_dns_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_dns_attribute" +description: |- + Data source for EPG uSeg Criterion DNS Attribute +--- + +# aci_epg_useg_criterion_dns_attribute # + +Data source for EPG uSeg Criterion DNS Attribute + +## API Information ## + +* Class: [fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview) + +* Supported in ACI versions: 2.3(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +```hcl + +data "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "dns_attribute" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Criterion DNS Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion DNS Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg Criterion DNS Attribute object. +* `filter` (filter) - (string) The domain name filter of the EPG uSeg Criterion DNS Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion DNS Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/epg_useg_criterion_identity_group_attribute.md b/docs/data-sources/epg_useg_criterion_identity_group_attribute.md new file mode 100644 index 000000000..9b82dc4f1 --- /dev/null +++ b/docs/data-sources/epg_useg_criterion_identity_group_attribute.md @@ -0,0 +1,64 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_identity_group_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_identity_group_attribute" +description: |- + Data source for EPG uSeg Criterion Identity Group Attribute +--- + +# aci_epg_useg_criterion_identity_group_attribute # + +Data source for EPG uSeg Criterion Identity Group Attribute + +## API Information ## + +* Class: [fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview) + +* Supported in ACI versions: 3.2(10e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +```hcl + +data "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `selector` (selector) - (string) The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion Identity Group Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg Criterion Identity Group Attribute object. +* `name` (name) - (string) The name of the EPG uSeg Criterion Identity Group Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion Identity Group Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/epg_useg_criterion_ip_attribute.md b/docs/data-sources/epg_useg_criterion_ip_attribute.md new file mode 100644 index 000000000..1e5b1d6e1 --- /dev/null +++ b/docs/data-sources/epg_useg_criterion_ip_attribute.md @@ -0,0 +1,65 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_ip_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_ip_attribute" +description: |- + Data source for EPG uSeg Criterion IP Attribute +--- + +# aci_epg_useg_criterion_ip_attribute # + +Data source for EPG uSeg Criterion IP Attribute + +## API Information ## + +* Class: [fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +```hcl + +data "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "131" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Criterion IP Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion IP Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg Criterion IP Attribute object. +* `ip` (ip) - (string) The device IP address of the EPG uSeg Criterion IP Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion IP Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `use_fv_subnet` (usefvSubnet) - (string) The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/epg_useg_criterion_mac_attribute.md b/docs/data-sources/epg_useg_criterion_mac_attribute.md new file mode 100644 index 000000000..bf84963de --- /dev/null +++ b/docs/data-sources/epg_useg_criterion_mac_attribute.md @@ -0,0 +1,64 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_mac_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_mac_attribute" +description: |- + Data source for EPG uSeg Criterion MAC Attribute +--- + +# aci_epg_useg_criterion_mac_attribute # + +Data source for EPG uSeg Criterion MAC Attribute + +## API Information ## + +* Class: [fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +```hcl + +data "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "mac_attr" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Criterion MAC Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion MAC Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg Criterion MAC Attribute object. +* `mac` (mac) - (string) The MAC address of the EPG uSeg Criterion MAC Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion MAC Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/epg_useg_criterion_vm_attribute.md b/docs/data-sources/epg_useg_criterion_vm_attribute.md new file mode 100644 index 000000000..ba95cdf91 --- /dev/null +++ b/docs/data-sources/epg_useg_criterion_vm_attribute.md @@ -0,0 +1,76 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_vm_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_vm_attribute" +description: |- + Data source for EPG uSeg Criterion VM Attribute +--- + +# aci_epg_useg_criterion_vm_attribute # + +Data source for EPG uSeg Criterion VM Attribute + +## API Information ## + +* Class: [fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Formats: + - `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/vmattr-{name}` + - `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +```hcl + +data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "vm_attribute" +} + +data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { + parent_dn = aci_epg_useg_sub_criterion.example.id + name = "vm_attribute" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Criterion VM Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion VM Attribute object. +* `category` (category) - (string) The category of the EPG uSeg Criterion VM Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg Criterion VM Attribute object. +* `label_name` (labelName) - (string) The label name of the EPG uSeg Criterion VM Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion VM Attribute object. +* `operator` (operator) - (string) The operator of the EPG uSeg Criterion VM Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `type` (type) - (string) The type of the EPG uSeg Criterion VM Attribute object. +* `value` (value) - (string) The value of the EPG uSeg Criterion VM Attribute object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/epg_useg_sub_criterion.md b/docs/data-sources/epg_useg_sub_criterion.md new file mode 100644 index 000000000..d4766e02d --- /dev/null +++ b/docs/data-sources/epg_useg_sub_criterion.md @@ -0,0 +1,64 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_sub_criterion" +sidebar_current: "docs-aci-data-source-aci_epg_useg_sub_criterion" +description: |- + Data source for EPG uSeg Sub Criterion +--- + +# aci_epg_useg_sub_criterion # + +Data source for EPG uSeg Sub Criterion + +## API Information ## + +* Class: [fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview) + +* Supported in ACI versions: 1.2(1i) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +```hcl + +data "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "sub_criterion" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Sub Criterion object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Sub Criterion object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Sub Criterion object. +* `description` (descr) - (string) The description of the EPG uSeg Sub Criterion object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Sub Criterion object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Sub Criterion object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/tag.md b/docs/data-sources/tag.md index 55e36e99e..93a5b34e4 100644 --- a/docs/data-sources/tag.md +++ b/docs/data-sources/tag.md @@ -55,25 +55,25 @@ data "aci_tag" "example_application_epg" { * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) + - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) + - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) - [aci_l3_outside](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) ([l3extOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extOut/overview)) - [aci_l3out_provider_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_provider_label) ([l3extProvLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extProvLbl/overview)) - [aci_logical_node_to_fabric_node](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_to_fabric_node) ([l3extRsNodeL3OutAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsNodeL3OutAtt/overview)) - - [aci_relation_to_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_fallback_route_group) ([l3extRsOutToFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsOutToFBRGroup/overview)) - - [aci_l3out_redistribute_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_redistribute_policy) ([l3extRsRedistributePol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsRedistributePol/overview)) - - [aci_external_management_network_instance_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_instance_profile) ([mgmtInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtInstP/overview)) - - [aci_relation_to_consumed_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_out_of_band_contract) ([mgmtRsOoBCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtRsOoBCons/overview)) - - [aci_external_management_network_subnet](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_subnet) ([mgmtSubnet](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtSubnet/overview)) - - [aci_l3out_node_sid_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_node_sid_profile) ([mplsNodeSidP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mplsNodeSidP/overview)) - - [aci_netflow_exporter_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_exporter_policy) ([netflowExporterPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowExporterPol/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/resources/annotation.md b/docs/resources/annotation.md index 85e946ee4..d27e94329 100644 --- a/docs/resources/annotation.md +++ b/docs/resources/annotation.md @@ -64,25 +64,25 @@ All examples for the Annotation resource can be found in the [examples](https:// * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) + - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) + - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) - [aci_l3_outside](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) ([l3extOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extOut/overview)) - [aci_l3out_provider_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_provider_label) ([l3extProvLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extProvLbl/overview)) - [aci_logical_node_to_fabric_node](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_to_fabric_node) ([l3extRsNodeL3OutAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsNodeL3OutAtt/overview)) - - [aci_relation_to_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_fallback_route_group) ([l3extRsOutToFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsOutToFBRGroup/overview)) - - [aci_l3out_redistribute_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_redistribute_policy) ([l3extRsRedistributePol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsRedistributePol/overview)) - - [aci_external_management_network_instance_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_instance_profile) ([mgmtInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtInstP/overview)) - - [aci_relation_to_consumed_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_out_of_band_contract) ([mgmtRsOoBCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtRsOoBCons/overview)) - - [aci_external_management_network_subnet](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_subnet) ([mgmtSubnet](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtSubnet/overview)) - - [aci_l3out_node_sid_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_node_sid_profile) ([mplsNodeSidP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mplsNodeSidP/overview)) - - [aci_netflow_exporter_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_exporter_policy) ([netflowExporterPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowExporterPol/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/docs/resources/endpoint_tag_ip.md b/docs/resources/endpoint_tag_ip.md index 369bbb796..fa5051fba 100644 --- a/docs/resources/endpoint_tag_ip.md +++ b/docs/resources/endpoint_tag_ip.md @@ -7,12 +7,12 @@ layout: "aci" page_title: "ACI: aci_endpoint_tag_ip" sidebar_current: "docs-aci-resource-aci_endpoint_tag_ip" description: |- - Manages ACI Endpoint Tag Ip + Manages ACI Endpoint Tag IP --- # aci_endpoint_tag_ip # -Manages ACI Endpoint Tag Ip +Manages ACI Endpoint Tag IP @@ -30,7 +30,7 @@ Manages ACI Endpoint Tag Ip ## Example Usage ## -The configuration snippet below creates a Endpoint Tag Ip with only required attributes. +The configuration snippet below creates a Endpoint Tag IP with only required attributes. ```hcl @@ -41,7 +41,7 @@ resource "aci_endpoint_tag_ip" "example_tenant" { } ``` -The configuration snippet below shows all possible attributes of the Endpoint Tag Ip. +The configuration snippet below shows all possible attributes of the Endpoint Tag IP. !> This example might not be valid configuration and is only used to show all possible attributes. @@ -71,7 +71,7 @@ resource "aci_endpoint_tag_ip" "full_example_tenant" { ``` -All examples for the Endpoint Tag Ip resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_endpoint_tag_ip) folder. +All examples for the Endpoint Tag IP resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_endpoint_tag_ip) folder. ## Schema ## @@ -79,20 +79,20 @@ All examples for the Endpoint Tag Ip resource can be found in the [examples](htt * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) -* `vrf_name` (ctxName) - (string) The VRF name of the Endpoint Tag Ip object. -* `ip` (ip) - (string) The IP address of the Endpoint Tag Ip object. +* `vrf_name` (ctxName) - (string) The VRF name of the Endpoint Tag IP object. +* `ip` (ip) - (string) The IP address of the Endpoint Tag IP object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the Endpoint Tag Ip object. +* `id` - (string) The distinguished name (DN) of the Endpoint Tag IP object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the Endpoint Tag Ip object. +* `annotation` (annotation) - (string) The annotation of the Endpoint Tag IP object. - Default: `orchestrator:terraform` -* `id_attribute` (id) - (string) The identifier of the Endpoint Tag Ip object. -* `name` (name) - (string) The name of the Endpoint Tag Ip object. -* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag Ip object. +* `id_attribute` (id) - (string) The identifier of the Endpoint Tag IP object. +* `name` (name) - (string) The name of the Endpoint Tag IP object. +* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag IP object. * `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. @@ -110,13 +110,13 @@ All examples for the Endpoint Tag Ip resource can be found in the [examples](htt ## Importing -An existing Endpoint Tag Ip can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing Endpoint Tag IP can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` terraform import aci_endpoint_tag_ip.example_tenant uni/tn-{name}/eptags/epiptag-[{ip}]-{ctxName} ``` -Starting in Terraform version 1.5, an existing Endpoint Tag Ip can be imported +Starting in Terraform version 1.5, an existing Endpoint Tag IP can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` diff --git a/docs/resources/endpoint_tag_mac.md b/docs/resources/endpoint_tag_mac.md index ee16a8ce0..60dc45a5c 100644 --- a/docs/resources/endpoint_tag_mac.md +++ b/docs/resources/endpoint_tag_mac.md @@ -7,12 +7,12 @@ layout: "aci" page_title: "ACI: aci_endpoint_tag_mac" sidebar_current: "docs-aci-resource-aci_endpoint_tag_mac" description: |- - Manages ACI Endpoint Tag Mac + Manages ACI Endpoint Tag MAC --- # aci_endpoint_tag_mac # -Manages ACI Endpoint Tag Mac +Manages ACI Endpoint Tag MAC @@ -30,7 +30,7 @@ Manages ACI Endpoint Tag Mac ## Example Usage ## -The configuration snippet below creates a Endpoint Tag Mac with only required attributes. +The configuration snippet below creates a Endpoint Tag MAC with only required attributes. ```hcl @@ -41,7 +41,7 @@ resource "aci_endpoint_tag_mac" "example_tenant" { } ``` -The configuration snippet below shows all possible attributes of the Endpoint Tag Mac. +The configuration snippet below shows all possible attributes of the Endpoint Tag MAC. !> This example might not be valid configuration and is only used to show all possible attributes. @@ -71,7 +71,7 @@ resource "aci_endpoint_tag_mac" "full_example_tenant" { ``` -All examples for the Endpoint Tag Mac resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_endpoint_tag_mac) folder. +All examples for the Endpoint Tag MAC resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_endpoint_tag_mac) folder. ## Schema ## @@ -79,20 +79,20 @@ All examples for the Endpoint Tag Mac resource can be found in the [examples](ht * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) -* `bd_name` (bdName) - (string) The bridge domain name of the Endpoint Tag Mac object. -* `mac` (mac) - (string) The MAC address of the Endpoint Tag Mac object. +* `bd_name` (bdName) - (string) The bridge domain name of the Endpoint Tag MAC object. +* `mac` (mac) - (string) The MAC address of the Endpoint Tag MAC object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the Endpoint Tag Mac object. +* `id` - (string) The distinguished name (DN) of the Endpoint Tag MAC object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the Endpoint Tag Mac object. +* `annotation` (annotation) - (string) The annotation of the Endpoint Tag MAC object. - Default: `orchestrator:terraform` -* `id_attribute` (id) - (string) The identifier of the Endpoint Tag Mac object. -* `name` (name) - (string) The name of the Endpoint Tag Mac object. -* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag Mac object. +* `id_attribute` (id) - (string) The identifier of the Endpoint Tag MAC object. +* `name` (name) - (string) The name of the Endpoint Tag MAC object. +* `name_alias` (nameAlias) - (string) The name alias of the Endpoint Tag MAC object. * `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. @@ -110,13 +110,13 @@ All examples for the Endpoint Tag Mac resource can be found in the [examples](ht ## Importing -An existing Endpoint Tag Mac can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing Endpoint Tag MAC can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` terraform import aci_endpoint_tag_mac.example_tenant uni/tn-{name}/eptags/epmactag-{mac}-[{bdName}] ``` -Starting in Terraform version 1.5, an existing Endpoint Tag Mac can be imported +Starting in Terraform version 1.5, an existing Endpoint Tag MAC can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` diff --git a/docs/resources/epg_useg_criterion.md b/docs/resources/epg_useg_criterion.md new file mode 100644 index 000000000..9bcd91170 --- /dev/null +++ b/docs/resources/epg_useg_criterion.md @@ -0,0 +1,143 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion" +sidebar_current: "docs-aci-resource-aci_epg_useg_criterion" +description: |- + Manages ACI EPG uSeg Criterion +--- + +# aci_epg_useg_criterion # + +Manages ACI EPG uSeg Criterion + + + +## API Information ## + +* Class: [fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +The configuration snippet below creates a EPG uSeg Criterion with only required attributes. + +```hcl + +resource "aci_epg_useg_criterion" "example_application_epg" { + parent_dn = aci_application_epg.example.id +} + +``` +The configuration snippet below shows all possible attributes of the EPG uSeg Criterion. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_epg_useg_criterion" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + match = "all" + name = "criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + precedence = "1" + scope = "scope-bd" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the EPG uSeg Criterion resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the EPG uSeg Criterion object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Criterion object. + - Default: `any` + - Valid Values: `all`, `any`. +* `name` (name) - (string) The name of the EPG uSeg Criterion object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `precedence` (prec) - (string) The precedence of the EPG uSeg Criterion object. +* `scope` (scope) - (string) The scope of the EPG uSeg Criterion object. + - Default: `scope-bd` + - Valid Values: `scope-bd`, `scope-vrf`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing EPG uSeg Criterion can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_epg_useg_criterion.example_application_epg uni/tn-{name}/ap-{name}/epg-{name}/crtrn +``` + +Starting in Terraform version 1.5, an existing EPG uSeg Criterion can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn" + to = aci_epg_useg_criterion.example_application_epg +} +``` + +## Child Resources + + - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) + - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) + - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) + - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) \ No newline at end of file diff --git a/docs/resources/epg_useg_criterion_dns_attribute.md b/docs/resources/epg_useg_criterion_dns_attribute.md new file mode 100644 index 000000000..4d5504522 --- /dev/null +++ b/docs/resources/epg_useg_criterion_dns_attribute.md @@ -0,0 +1,128 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_dns_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_dns_attribute" +description: |- + Manages ACI EPG uSeg Criterion DNS Attribute +--- + +# aci_epg_useg_criterion_dns_attribute # + +Manages ACI EPG uSeg Criterion DNS Attribute + + + +## API Information ## + +* Class: [fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview) + +* Supported in ACI versions: 2.3(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +The configuration snippet below creates a EPG uSeg Criterion DNS Attribute with only required attributes. + +```hcl + +resource "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "dns_attribute" +} + +``` +The configuration snippet below shows all possible attributes of the EPG uSeg Criterion DNS Attribute. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_epg_useg_criterion_dns_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + filter = "filter" + name = "dns_attribute" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the EPG uSeg Criterion DNS Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_dns_attribute) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Criterion DNS Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion DNS Attribute object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the EPG uSeg Criterion DNS Attribute object. +* `filter` (filter) - (string) The domain name filter of the EPG uSeg Criterion DNS Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion DNS Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing EPG uSeg Criterion DNS Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_epg_useg_criterion_dns_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name} +``` + +Starting in Terraform version 1.5, an existing EPG uSeg Criterion DNS Attribute can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name}" + to = aci_epg_useg_criterion_dns_attribute.example_epg_useg_criterion +} +``` diff --git a/docs/resources/epg_useg_criterion_identity_group_attribute.md b/docs/resources/epg_useg_criterion_identity_group_attribute.md new file mode 100644 index 000000000..55ede7363 --- /dev/null +++ b/docs/resources/epg_useg_criterion_identity_group_attribute.md @@ -0,0 +1,128 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_identity_group_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_identity_group_attribute" +description: |- + Manages ACI EPG uSeg Criterion Identity Group Attribute +--- + +# aci_epg_useg_criterion_identity_group_attribute # + +Manages ACI EPG uSeg Criterion Identity Group Attribute + + + +## API Information ## + +* Class: [fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview) + +* Supported in ACI versions: 3.2(10e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +The configuration snippet below creates a EPG uSeg Criterion Identity Group Attribute with only required attributes. + +```hcl + +resource "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} + +``` +The configuration snippet below shows all possible attributes of the EPG uSeg Criterion Identity Group Attribute. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_epg_useg_criterion_identity_group_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + name = "name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the EPG uSeg Criterion Identity Group Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_identity_group_attribute) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `selector` (selector) - (string) The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion Identity Group Attribute object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the EPG uSeg Criterion Identity Group Attribute object. +* `name` (name) - (string) The name of the EPG uSeg Criterion Identity Group Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion Identity Group Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing EPG uSeg Criterion Identity Group Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_epg_useg_criterion_identity_group_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}] +``` + +Starting in Terraform version 1.5, an existing EPG uSeg Criterion Identity Group Attribute can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}]" + to = aci_epg_useg_criterion_identity_group_attribute.example_epg_useg_criterion +} +``` diff --git a/docs/resources/epg_useg_criterion_ip_attribute.md b/docs/resources/epg_useg_criterion_ip_attribute.md new file mode 100644 index 000000000..54217f68d --- /dev/null +++ b/docs/resources/epg_useg_criterion_ip_attribute.md @@ -0,0 +1,133 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_ip_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_ip_attribute" +description: |- + Manages ACI EPG uSeg Criterion IP Attribute +--- + +# aci_epg_useg_criterion_ip_attribute # + +Manages ACI EPG uSeg Criterion IP Attribute + + + +## API Information ## + +* Class: [fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +The configuration snippet below creates a EPG uSeg Criterion IP Attribute with only required attributes. + +```hcl + +resource "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + ip = "131.107.1.200" + name = "131" +} + +``` +The configuration snippet below shows all possible attributes of the EPG uSeg Criterion IP Attribute. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_epg_useg_criterion_ip_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + ip = "131.107.1.200" + name = "131" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + use_fv_subnet = "yes" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the EPG uSeg Criterion IP Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_ip_attribute) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `ip` (ip) - (string) The device IP address of the EPG uSeg Criterion IP Attribute object. +* `name` (name) - (string) The name of the EPG uSeg Criterion IP Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion IP Attribute object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the EPG uSeg Criterion IP Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion IP Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `use_fv_subnet` (usefvSubnet) - (string) The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object. + - Default: `no` + - Valid Values: `no`, `yes`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing EPG uSeg Criterion IP Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_epg_useg_criterion_ip_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name} +``` + +Starting in Terraform version 1.5, an existing EPG uSeg Criterion IP Attribute can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name}" + to = aci_epg_useg_criterion_ip_attribute.example_epg_useg_criterion +} +``` diff --git a/docs/resources/epg_useg_criterion_mac_attribute.md b/docs/resources/epg_useg_criterion_mac_attribute.md new file mode 100644 index 000000000..9cff1252c --- /dev/null +++ b/docs/resources/epg_useg_criterion_mac_attribute.md @@ -0,0 +1,129 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_mac_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_mac_attribute" +description: |- + Manages ACI EPG uSeg Criterion MAC Attribute +--- + +# aci_epg_useg_criterion_mac_attribute # + +Manages ACI EPG uSeg Criterion MAC Attribute + + + +## API Information ## + +* Class: [fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +The configuration snippet below creates a EPG uSeg Criterion MAC Attribute with only required attributes. + +```hcl + +resource "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" +} + +``` +The configuration snippet below shows all possible attributes of the EPG uSeg Criterion MAC Attribute. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_epg_useg_criterion_mac_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the EPG uSeg Criterion MAC Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_mac_attribute) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `mac` (mac) - (string) The MAC address of the EPG uSeg Criterion MAC Attribute object. +* `name` (name) - (string) The name of the EPG uSeg Criterion MAC Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion MAC Attribute object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the EPG uSeg Criterion MAC Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion MAC Attribute object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing EPG uSeg Criterion MAC Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_epg_useg_criterion_mac_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name} +``` + +Starting in Terraform version 1.5, an existing EPG uSeg Criterion MAC Attribute can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name}" + to = aci_epg_useg_criterion_mac_attribute.example_epg_useg_criterion +} +``` diff --git a/docs/resources/epg_useg_criterion_vm_attribute.md b/docs/resources/epg_useg_criterion_vm_attribute.md new file mode 100644 index 000000000..2ae7847dc --- /dev/null +++ b/docs/resources/epg_useg_criterion_vm_attribute.md @@ -0,0 +1,177 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_criterion_vm_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_vm_attribute" +description: |- + Manages ACI EPG uSeg Criterion VM Attribute +--- + +# aci_epg_useg_criterion_vm_attribute # + +Manages ACI EPG uSeg Criterion VM Attribute + + + +## API Information ## + +* Class: [fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview) + +* Supported in ACI versions: 1.1(1j) and later. + +* Distinguished Name Formats: + - `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/vmattr-{name}` + - `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +The configuration snippet below creates a EPG uSeg Criterion VM Attribute with only required attributes. + +```hcl + +resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "vm_attribute" + value = "default_value" +} + +resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { + parent_dn = aci_epg_useg_sub_criterion.example.id + name = "vm_attribute" + value = "default_value" +} + +``` +The configuration snippet below shows all possible attributes of the EPG uSeg Criterion VM Attribute. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name = "vm_attribute" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_sub_criterion" { + parent_dn = aci_epg_useg_sub_criterion.example.id + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name = "vm_attribute" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the EPG uSeg Criterion VM Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_vm_attribute) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Criterion VM Attribute object. +* `value` (value) - (string) The value of the EPG uSeg Criterion VM Attribute object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion VM Attribute object. + - Default: `orchestrator:terraform` +* `category` (category) - (string) The category of the EPG uSeg Criterion VM Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg Criterion VM Attribute object. +* `label_name` (labelName) - (string) The label name of the EPG uSeg Criterion VM Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion VM Attribute object. +* `operator` (operator) - (string) The operator of the EPG uSeg Criterion VM Attribute object. + - Default: `equals` + - Valid Values: `contains`, `endsWith`, `equals`, `notEquals`, `startsWith`. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. +* `type` (type) - (string) The type of the EPG uSeg Criterion VM Attribute object. + - Default: `vm-name` + - Valid Values: `custom-label`, `domain`, `guest-os`, `hv`, `rootContName`, `tag`, `vm`, `vm-folder`, `vm-name`, `vmfolder-path`, `vnic`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing EPG uSeg Criterion VM Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_epg_useg_criterion_vm_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name} +``` + +Starting in Terraform version 1.5, an existing EPG uSeg Criterion VM Attribute can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name}" + to = aci_epg_useg_criterion_vm_attribute.example_epg_useg_criterion +} +``` diff --git a/docs/resources/epg_useg_sub_criterion.md b/docs/resources/epg_useg_sub_criterion.md new file mode 100644 index 000000000..ea4d9a99f --- /dev/null +++ b/docs/resources/epg_useg_sub_criterion.md @@ -0,0 +1,137 @@ +--- +# Documentation generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_epg_useg_sub_criterion" +sidebar_current: "docs-aci-resource-aci_epg_useg_sub_criterion" +description: |- + Manages ACI EPG uSeg Sub Criterion +--- + +# aci_epg_useg_sub_criterion # + +Manages ACI EPG uSeg Sub Criterion + + + +## API Information ## + +* Class: [fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview) + +* Supported in ACI versions: 1.2(1i) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes` + +## Example Usage ## + +The configuration snippet below creates a EPG uSeg Sub Criterion with only required attributes. + +```hcl + +resource "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "sub_criterion" +} + +``` +The configuration snippet below shows all possible attributes of the EPG uSeg Sub Criterion. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_epg_useg_sub_criterion" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + match = "all" + name = "sub_criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the EPG uSeg Sub Criterion resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_sub_criterion) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Sub Criterion object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the EPG uSeg Sub Criterion object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Sub Criterion object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the EPG uSeg Sub Criterion object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Sub Criterion object. + - Default: `any` + - Valid Values: `all`, `any`. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Sub Criterion object. +* `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. +* `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing EPG uSeg Sub Criterion can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: + +``` +terraform import aci_epg_useg_sub_criterion.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name} +``` + +Starting in Terraform version 1.5, an existing EPG uSeg Sub Criterion can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}" + to = aci_epg_useg_sub_criterion.example_epg_useg_criterion +} +``` + +## Child Resources + + - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) + - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) + - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) \ No newline at end of file diff --git a/docs/resources/tag.md b/docs/resources/tag.md index d879337bc..a9280a316 100644 --- a/docs/resources/tag.md +++ b/docs/resources/tag.md @@ -64,25 +64,25 @@ All examples for the Tag resource can be found in the [examples](https://github. * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) + - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) + - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) + - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) - [aci_l3_outside](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3_outside) ([l3extOut](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extOut/overview)) - [aci_l3out_provider_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_provider_label) ([l3extProvLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extProvLbl/overview)) - [aci_logical_node_to_fabric_node](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_to_fabric_node) ([l3extRsNodeL3OutAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsNodeL3OutAtt/overview)) - - [aci_relation_to_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_fallback_route_group) ([l3extRsOutToFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsOutToFBRGroup/overview)) - - [aci_l3out_redistribute_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_redistribute_policy) ([l3extRsRedistributePol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extRsRedistributePol/overview)) - - [aci_external_management_network_instance_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_instance_profile) ([mgmtInstP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtInstP/overview)) - - [aci_relation_to_consumed_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_out_of_band_contract) ([mgmtRsOoBCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtRsOoBCons/overview)) - - [aci_external_management_network_subnet](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/external_management_network_subnet) ([mgmtSubnet](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mgmtSubnet/overview)) - - [aci_l3out_node_sid_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_node_sid_profile) ([mplsNodeSidP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/mplsNodeSidP/overview)) - - [aci_netflow_exporter_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/netflow_exporter_policy) ([netflowExporterPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowExporterPol/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/examples/data-sources/aci_epg_useg_criterion/data-source.tf b/examples/data-sources/aci_epg_useg_criterion/data-source.tf new file mode 100644 index 000000000..ea12145c9 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion/data-source.tf @@ -0,0 +1,4 @@ + +data "aci_epg_useg_criterion" "example_application_epg" { + parent_dn = aci_application_epg.example.id +} diff --git a/examples/data-sources/aci_epg_useg_criterion/provider.tf b/examples/data-sources/aci_epg_useg_criterion/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_epg_useg_criterion_dns_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_dns_attribute/data-source.tf new file mode 100644 index 000000000..fd1b5dee2 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_dns_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "dns_attribute" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_dns_attribute/provider.tf b/examples/data-sources/aci_epg_useg_criterion_dns_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_dns_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/data-source.tf new file mode 100644 index 000000000..1d1c9c71d --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/provider.tf b/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_epg_useg_criterion_ip_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_ip_attribute/data-source.tf new file mode 100644 index 000000000..d9959e4f1 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_ip_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "131" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_ip_attribute/provider.tf b/examples/data-sources/aci_epg_useg_criterion_ip_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_ip_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_epg_useg_criterion_mac_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_mac_attribute/data-source.tf new file mode 100644 index 000000000..f78c5c969 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_mac_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "mac_attr" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_mac_attribute/provider.tf b/examples/data-sources/aci_epg_useg_criterion_mac_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_mac_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_epg_useg_criterion_vm_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_vm_attribute/data-source.tf new file mode 100644 index 000000000..2c31998b2 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_vm_attribute/data-source.tf @@ -0,0 +1,10 @@ + +data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "vm_attribute" +} + +data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { + parent_dn = aci_epg_useg_sub_criterion.example.id + name = "vm_attribute" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_vm_attribute/provider.tf b/examples/data-sources/aci_epg_useg_criterion_vm_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_criterion_vm_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_epg_useg_sub_criterion/data-source.tf b/examples/data-sources/aci_epg_useg_sub_criterion/data-source.tf new file mode 100644 index 000000000..7adadc33a --- /dev/null +++ b/examples/data-sources/aci_epg_useg_sub_criterion/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "sub_criterion" +} diff --git a/examples/data-sources/aci_epg_useg_sub_criterion/provider.tf b/examples/data-sources/aci_epg_useg_sub_criterion/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_sub_criterion/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_criterion/provider.tf b/examples/resources/aci_epg_useg_criterion/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_criterion/resource-all-attributes.tf b/examples/resources/aci_epg_useg_criterion/resource-all-attributes.tf new file mode 100644 index 000000000..33b616d5e --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion/resource-all-attributes.tf @@ -0,0 +1,25 @@ + +resource "aci_epg_useg_criterion" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + match = "all" + name = "criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + precedence = "1" + scope = "scope-bd" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_criterion/resource.tf b/examples/resources/aci_epg_useg_criterion/resource.tf new file mode 100644 index 000000000..717dd4565 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion/resource.tf @@ -0,0 +1,4 @@ + +resource "aci_epg_useg_criterion" "example_application_epg" { + parent_dn = aci_application_epg.example.id +} diff --git a/examples/resources/aci_epg_useg_criterion_dns_attribute/provider.tf b/examples/resources/aci_epg_useg_criterion_dns_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_dns_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_criterion_dns_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_criterion_dns_attribute/resource-all-attributes.tf new file mode 100644 index 000000000..0357f9fdf --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_dns_attribute/resource-all-attributes.tf @@ -0,0 +1,23 @@ + +resource "aci_epg_useg_criterion_dns_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + filter = "filter" + name = "dns_attribute" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_criterion_dns_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_dns_attribute/resource.tf new file mode 100644 index 000000000..10aec07b7 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_dns_attribute/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "dns_attribute" +} diff --git a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/provider.tf b/examples/resources/aci_epg_useg_criterion_identity_group_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_identity_group_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource-all-attributes.tf new file mode 100644 index 000000000..3e64253a6 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource-all-attributes.tf @@ -0,0 +1,23 @@ + +resource "aci_epg_useg_criterion_identity_group_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + name = "name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource.tf new file mode 100644 index 000000000..2ee611257 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} diff --git a/examples/resources/aci_epg_useg_criterion_ip_attribute/provider.tf b/examples/resources/aci_epg_useg_criterion_ip_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_ip_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_criterion_ip_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_criterion_ip_attribute/resource-all-attributes.tf new file mode 100644 index 000000000..e55d218e6 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_ip_attribute/resource-all-attributes.tf @@ -0,0 +1,24 @@ + +resource "aci_epg_useg_criterion_ip_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + ip = "131.107.1.200" + name = "131" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + use_fv_subnet = "yes" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_criterion_ip_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_ip_attribute/resource.tf new file mode 100644 index 000000000..d2d0ee7e7 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_ip_attribute/resource.tf @@ -0,0 +1,6 @@ + +resource "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + ip = "131.107.1.200" + name = "131" +} diff --git a/examples/resources/aci_epg_useg_criterion_mac_attribute/provider.tf b/examples/resources/aci_epg_useg_criterion_mac_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_mac_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_criterion_mac_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_criterion_mac_attribute/resource-all-attributes.tf new file mode 100644 index 000000000..d4cb2291c --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_mac_attribute/resource-all-attributes.tf @@ -0,0 +1,23 @@ + +resource "aci_epg_useg_criterion_mac_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_criterion_mac_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_mac_attribute/resource.tf new file mode 100644 index 000000000..03bf22870 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_mac_attribute/resource.tf @@ -0,0 +1,6 @@ + +resource "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" +} diff --git a/examples/resources/aci_epg_useg_criterion_vm_attribute/provider.tf b/examples/resources/aci_epg_useg_criterion_vm_attribute/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_vm_attribute/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_criterion_vm_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_criterion_vm_attribute/resource-all-attributes.tf new file mode 100644 index 000000000..3e8b86cbc --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_vm_attribute/resource-all-attributes.tf @@ -0,0 +1,54 @@ + +resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name = "vm_attribute" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_sub_criterion" { + parent_dn = aci_epg_useg_sub_criterion.example.id + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name = "vm_attribute" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_criterion_vm_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_vm_attribute/resource.tf new file mode 100644 index 000000000..4aecc213c --- /dev/null +++ b/examples/resources/aci_epg_useg_criterion_vm_attribute/resource.tf @@ -0,0 +1,12 @@ + +resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "vm_attribute" + value = "default_value" +} + +resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { + parent_dn = aci_epg_useg_sub_criterion.example.id + name = "vm_attribute" + value = "default_value" +} diff --git a/examples/resources/aci_epg_useg_sub_criterion/provider.tf b/examples/resources/aci_epg_useg_sub_criterion/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_epg_useg_sub_criterion/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_epg_useg_sub_criterion/resource-all-attributes.tf b/examples/resources/aci_epg_useg_sub_criterion/resource-all-attributes.tf new file mode 100644 index 000000000..b5c564521 --- /dev/null +++ b/examples/resources/aci_epg_useg_sub_criterion/resource-all-attributes.tf @@ -0,0 +1,23 @@ + +resource "aci_epg_useg_sub_criterion" "full_example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + annotation = "annotation" + description = "description" + match = "all" + name = "sub_criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_sub_criterion/resource.tf b/examples/resources/aci_epg_useg_sub_criterion/resource.tf new file mode 100644 index 000000000..a3ad85efb --- /dev/null +++ b/examples/resources/aci_epg_useg_sub_criterion/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { + parent_dn = aci_epg_useg_criterion.example.id + name = "sub_criterion" +} diff --git a/gen/definitions/classes.yaml b/gen/definitions/classes.yaml index a28175ee5..9c1b6d85b 100644 --- a/gen/definitions/classes.yaml +++ b/gen/definitions/classes.yaml @@ -218,3 +218,65 @@ mplsNodeSidP: - "uni/tn-{name}/out-{name}/lnodep-{name}/rsnodeL3OutAtt-[{tDn}]/lbp-[{addr}]/nodesidp-{sidoffset}" contained_by: - "l3extLoopBackIfP" + +fvCrtrn: + resource_name: "epg_useg_criterion" + ui_locations: + - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" + sub_category: "Application Management" + include: true + +fvSCrtrn: + resource_name: "epg_useg_sub_criterion" + ui_locations: + - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" + sub_category: "Application Management" + dn_formats: + - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}" + contained_by: + - "fvCrtrn" + +fvVmAttr: + resource_name: "epg_useg_criterion_vm_attribute" + ui_locations: + - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" + sub_category: "Application Management" + dn_formats: + - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name}" + - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/vmattr-{name}" + +fvIdGroupAttr: + resource_name: "epg_useg_criterion_identity_group_attribute" + ui_locations: + - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" + sub_category: "Application Management" + dn_formats: + - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}]" + +fvDnsAttr: + resource_name: "epg_useg_criterion_dns_attribute" + ui_locations: + - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" + sub_category: "Application Management" + dn_formats: + - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name}" + +fvMacAttr: + resource_name: "epg_useg_criterion_mac_attribute" + ui_locations: + - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" + sub_category: "Application Management" + dn_formats: + - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name}" + contained_by: + - "fvCrtrn" + +fvIpAttr: + resource_name: "epg_useg_criterion_ip_attribute" + ui_locations: + - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" + sub_category: "Application Management" + dn_formats: + - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name}" + contained_by: + - "fvCrtrn" diff --git a/gen/definitions/properties.yaml b/gen/definitions/properties.yaml index 7f582469f..c0fdc9c17 100644 --- a/gen/definitions/properties.yaml +++ b/gen/definitions/properties.yaml @@ -23,6 +23,12 @@ global: resource_name_doc_overwrite: Vrf: VRF Sid: "SR-MPLS Segment ID" + Epg: "EPG" + Useg: "uSeg" + Vm: "VM" + Dns: "DNS" + Mac: "MAC" + Ip: "IP" ignores: - "userdom" @@ -300,7 +306,7 @@ netflowRecordPol: default_values: parent_dn: "uni/infra" remove_valid_values: - match: + match: - "unspecified" test_values: default: @@ -308,10 +314,10 @@ netflowRecordPol: collect_parameters: - "src-intf" all: - collect_parameters: + collect_parameters: - "count-bytes" - "src-intf" - match_parameters: + match_parameters: - "dst-ip" - "src-ip" resource_required: @@ -327,3 +333,136 @@ netflowRecordPol: - class_name: "fvTenant" parent_dependency: "" parent_dn: "aci_tenant.test.id" + +fvCrtrn: + overwrites: + prec: "precedence" + documentation: + match: "The Matching Rule Type of the %s object." + prec: "The precedence of the %s object." + scope: "The scope of the %s object." + test_values: + default: + match: "any" + precedence: "0" + scope: "scope-bd" + all: + match: "all" + precedence: "1" + name: "criterion" + resource_required: + name: "criterion" + datasource_required: + name: "criterion" + datasource_non_existing: + name: "criterion_non_existing" + +fvSCrtrn: + documentation: + match: "The Matching Rule Type of the %s object." + test_values: + default: + match: "any" + all: + match: "all" + resource_required: + name: "sub_criterion" + datasource_required: + name: "sub_criterion" + datasource_non_existing: + name: "sub_criterion_non_existing" + +fvVmAttr: + resource_required: + - value + overwrites: + labelName: "label_name" + documentation: + value: "The value of the %s object." + type: "The type of the %s object." + operator: "The operator of the %s object." + labelName: "The label name of the %s object." + category: "The category of the %s object." + test_values: + default: + type: "vm-name" + operator: "equals" + value: "default_value" + all: + type: "domain" + operator: "contains" + value: "all_value" + label_name: "label_name" + category: "all_category" + resource_required: + name: "vm_attribute" + value: "default_value" + datasource_required: + name: "vm_attribute" + datasource_non_existing: + name: "vm_attribute_non_existing" + +fvIdGroupAttr: + documentation: + selector: "The selector of the %s object. Represents the DN or expression to select an identity group." + test_values: + resource_required: + selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + datasource_required: + selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + datasource_non_existing: + selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng_non_existing" + +fvDnsAttr: + documentation: + filter: "The domain name filter of the %s object." + test_values: + resource_required: + name: "dns_attribute" + filter: "test_filter" + datasource_required: + name: "dns_attribute" + datasource_non_existing: + name: "dns_attribute_non_existing" + +fvMacAttr: + resource_required: + - mac + test_values: + default: + mac: "AA:BB:CC:DD:EE:FF" + all: + mac: "AA:BB:CC:BB:BB:EE" + resource_required: + name: "mac_attr" + mac: "AA:BB:CC:DD:EE:FF" + datasource_required: + name: "mac_attr" + datasource_non_existing: + name: "mac_attr_non_existing" + +fvIpAttr: + resource_required: + - ip + overwrites: + usefv_subnet: "use_fv_subnet" + documentation: + ip: "The device IP address of the %s object." + usefvSubnet: "The usefvSubnet flag of the %s object." + default_values: + usefvSubnet: "no" + test_values: + default: + use_fv_subnet: "no" + ip: "131.107.1.200" + name: "131" + all: + use_fv_subnet: "yes" + ip: "0.0.0.0" + resource_required: + name: "131" + ip: "131.107.1.200" + datasource_required: + name: "131" + datasource_non_existing: + name: "131_non_existing" diff --git a/gen/generator.go b/gen/generator.go index 20666c6fe..975906209 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -168,8 +168,8 @@ func CreateParentDnValue(className, caller string, definitions Definitions) stri func LookupTestValue(classPkgName, propertyName string, testVars map[string]interface{}, definitions Definitions) interface{} { var lookupValue interface{} = "test_value" propertyName = GetOverwriteAttributeName(classPkgName, propertyName, definitions) - _, ok := testVars["all"] - if ok { + + if _, ok := testVars["all"]; ok && testVars["all"] != nil { val, ok := testVars["all"].(interface{}).(map[interface{}]interface{})[propertyName] if ok { switch val := val.(type) { @@ -180,8 +180,8 @@ func LookupTestValue(classPkgName, propertyName string, testVars map[string]inte } } } - _, ok = testVars["resource_required"] - if ok { + + if _, ok := testVars["resource_required"]; ok && testVars["resource_required"] != nil { val, ok := testVars["resource_required"].(interface{}).(map[interface{}]interface{})[propertyName] if ok { lookupValue = val.(string) @@ -217,9 +217,11 @@ func ContainsNoneAttributeValue(values []string) bool { return false } -func DefinedInMap(s string, values map[interface{}]interface{}) bool { - if _, ok := values[s]; ok { - return true +func DefinedInMap(s string, values interface{}) bool { + if values != nil { + if _, ok := values.(map[interface{}]interface{})[s]; ok { + return true + } } return false } @@ -915,8 +917,6 @@ func (m *Model) SetClassInclude() { for key, value := range classDetails.(map[interface{}]interface{}) { if key.(string) == "include" { m.Include = value.(bool) - } else { - m.Include = false } } } diff --git a/gen/meta/fvCrtrn.json b/gen/meta/fvCrtrn.json new file mode 100644 index 000000000..4a25f3083 --- /dev/null +++ b/gen/meta/fvCrtrn.json @@ -0,0 +1,832 @@ +{ + "fv:Crtrn": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "fv:DnsAttr": "", + "fv:IdGroupAttr": "", + "fv:IpAttr": "", + "fv:MacAttr": "", + "fv:ProtoAttr": "", + "fv:SCrtrn": "", + "fv:UsegBDCont": "", + "fv:VmAttr": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "bdcont": "fv:UsegBDCont", + "crtrn-": "fv:SCrtrn", + "dnsattr-": "fv:DnsAttr", + "fd-": "fault:Delegate", + "idgattr-": "fv:IdGroupAttr", + "ipattr-": "fv:IpAttr", + "macattr-": "fv:MacAttr", + "protoattr-": "fv:ProtoAttr", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag", + "vmattr-": "fv:VmAttr" + }, + "identifiedBy": [ + + ], + "rnFormat": "crtrn", + "containedBy": { + "fv:AEPg": "" + }, + "superClasses": [ + "fv:ACrtrn", + "fv:AACrtrn", + "fv:ACrRule", + "fv:AClassifier", + "fv:Def", + "pol:DefRoot", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "readAccess": [ + "admin", + "tenant-connectivity", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4211954": "creation||fv:Crtrn", + "E4211955": "modification||fv:Crtrn", + "E4211956": "deletion||fv:Crtrn" + }, + "stats": { + + }, + "versions": "1.1(1j)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "6191", + "className": "Crtrn", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "Criterion", + "comment": [ + "A criterion." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38209", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition root." + ], + "isConfigurable": true, + "propGlobalId": "5614", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40348", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "match": { + "versions": "1.2(1i)-", + "isConfigurable": true, + "propGlobalId": "20374", + "propLocalId": "5227", + "label": "Matching Rule Type", + "baseType": "scalar:Enum8", + "modelType": "fv:MatchT", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "1", "localName": "all", + "platformFlavors": [ + + ], + "label": "Match All "}, + { "value": "0", "localName": "any", + "platformFlavors": [ + + ], + "label": "Match Any "}, + { "value": "any", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "any", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.0(1e)-", + "comment": [ + "null" + ], + "isConfigurable": true, + "propGlobalId": "4991", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "prec": { + "versions": "4.1(1i)-", + "isConfigurable": true, + "propGlobalId": "51760", + "propLocalId": "5228", + "label": "Precedence", + "baseType": "scalar:Uint32", + "modelType": "scalar:Uint32", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "scope": { + "versions": "4.1(1i)-", + "comment": [ + "The domain applicable to the capability." + ], + "isConfigurable": true, + "propGlobalId": "51761", + "propLocalId": "1", + "label": "Criterion Scope", + "baseType": "scalar:Enum8", + "modelType": "fv:CrtrnScopeT", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "scope-bd", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "scope-bd", + "platformFlavors": [ + + ], + "label": "BD "}, + { "value": "1", "localName": "scope-vrf", + "platformFlavors": [ + + ], + "label": "VRF "} + ], + "default": "scope-bd", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvDnsAttr.json b/gen/meta/fvDnsAttr.json new file mode 100644 index 000000000..550ceac3e --- /dev/null +++ b/gen/meta/fvDnsAttr.json @@ -0,0 +1,727 @@ +{ + "fv:DnsAttr": { + "contains": { + "aaa:RbacAnnotation": "", + "dnsepg:IpAddrBlk": "", + "fault:Delegate": "", + "fv:RtDnsAttrRel": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "fromaddr-": "dnsepg:IpAddrBlk", + "rbacDom-": "aaa:RbacAnnotation", + "rtpolDnsAttrRel-": "fv:RtDnsAttrRel", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "dnsattr-{name}", + "containedBy": { + "fv:Crtrn": "" + }, + "superClasses": [ + "fv:ADnsAttr", + "fv:Attr", + "fv:Def", + "pol:DefRoot", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "fv:RtDnsAttrRel": "pol:DefRelnHolder" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name}" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "readAccess": [ + "admin", + "tenant-connectivity", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4213725": "creation||fv:DnsAttr", + "E4213726": "modification||fv:DnsAttr", + "E4213727": "deletion||fv:DnsAttr" + }, + "stats": { + + }, + "versions": "2.3(1e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "10667", + "className": "DnsAttr", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "DNS Attribute", + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38696", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition root." + ], + "isConfigurable": true, + "propGlobalId": "5614", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40835", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "filter": { + "versions": "2.3(1e)-", + "isConfigurable": true, + "propGlobalId": "33267", + "propLocalId": "720", + "label": "Domain Name Filter", + "baseType": "string:Basic", + "modelType": "dnsepg:Filter", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 512 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "2.3(1e)-", + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "33289", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvIdGroupAttr.json b/gen/meta/fvIdGroupAttr.json new file mode 100644 index 000000000..5735d43d2 --- /dev/null +++ b/gen/meta/fvIdGroupAttr.json @@ -0,0 +1,729 @@ +{ + "fv:IdGroupAttr": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "fv:RsFltIdGrp": "", + "fv:RtIdgAttrRel": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "rsfltIdGrp": "fv:RsFltIdGrp", + "rtpolIdgAttrRel-": "fv:RtIdgAttrRel", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "selector" + ], + "rnFormat": "idgattr-[{selector}]", + "containedBy": { + "fv:Crtrn": "" + }, + "superClasses": [ + "fv:AIdAttr", + "fv:Attr", + "fv:Def", + "pol:DefRoot", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "fv:RtIdgAttrRel": "pol:DefRelnHolder" + }, + "relationTo": { + "fv:RsFltIdGrp": "adepg:Group" + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}]" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "readAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4215765": "creation||fv:IdGroupAttr", + "E4215766": "modification||fv:IdGroupAttr", + "E4215767": "deletion||fv:IdGroupAttr" + }, + "stats": { + + }, + "versions": "3.2(10e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "12632", + "className": "IdGroupAttr", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "Identity Group Attribute", + "properties": { + "annotation": { + "versions": "3.2(10e)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "43888", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition root." + ], + "isConfigurable": true, + "propGlobalId": "5614", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(10e)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "43889", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.0(1e)-", + "comment": [ + "null" + ], + "isConfigurable": true, + "propGlobalId": "4991", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "selector": { + "versions": "3.2(10e)-", + "comment": [ + "Represents the Dn or expression to select an identity group" + ], + "isConfigurable": true, + "propGlobalId": "44665", + "propLocalId": "9854", + "label": "Identity Group Selector", + "baseType": "string:Basic", + "modelType": "auth:DelimitedString", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 1, "max": 512 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvIpAttr.json b/gen/meta/fvIpAttr.json new file mode 100644 index 000000000..2e25301fc --- /dev/null +++ b/gen/meta/fvIpAttr.json @@ -0,0 +1,773 @@ +{ + "fv:IpAttr": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "ipattr-{name}", + "containedBy": { + "fv:Crtrn": "", + "fv:SCrtrn": "" + }, + "superClasses": [ + "fv:AIpAttr", + "fv:AStAttr", + "fv:Attr", + "fv:Def", + "pol:DefRoot", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/ipattr-{name}", + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name}" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "readAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4214117": "creation||fv:IpAttr", + "E4214118": "modification||fv:IpAttr", + "E4214119": "deletion||fv:IpAttr" + }, + "stats": { + + }, + "versions": "1.1(1j)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "6196", + "className": "IpAttr", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "IP Attribute", + "comment": [ + "The IP based attributes." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38211", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition root." + ], + "isConfigurable": true, + "propGlobalId": "5614", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40350", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ip": { + "versions": "1.1(1j)-", + "comment": [ + "The device IP address." + ], + "isConfigurable": true, + "propGlobalId": "18438", + "propLocalId": "413", + "label": "IP Address", + "baseType": "address:Ip", + "modelType": "address:Ip", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validateAsIPv4OrIPv6": true, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.1(1j)-", + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "18454", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "usefvSubnet": { + "versions": "2.0(1m)-", + "isConfigurable": true, + "propGlobalId": "26304", + "propLocalId": "6246", + "label": "Use Subnet Address", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvMacAttr.json b/gen/meta/fvMacAttr.json new file mode 100644 index 000000000..0a415388e --- /dev/null +++ b/gen/meta/fvMacAttr.json @@ -0,0 +1,729 @@ +{ + "fv:MacAttr": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "macattr-{name}", + "containedBy": { + "fv:Crtrn": "", + "fv:SCrtrn": "" + }, + "superClasses": [ + "fv:AMacAttr", + "fv:AStAttr", + "fv:Attr", + "fv:Def", + "pol:DefRoot", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/macattr-{name}", + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name}" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "readAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4214120": "creation||fv:MacAttr", + "E4214121": "modification||fv:MacAttr", + "E4214122": "deletion||fv:MacAttr" + }, + "stats": { + + }, + "versions": "1.1(1j)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "6198", + "className": "MacAttr", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "MAC Attribute", + "comment": [ + "A MAC based attribute." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38212", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition root." + ], + "isConfigurable": true, + "propGlobalId": "5614", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40351", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "mac": { + "versions": "1.1(1j)-", + "comment": [ + "The device MAC address." + ], + "isConfigurable": true, + "propGlobalId": "18439", + "propLocalId": "480", + "label": "MAC Address", + "baseType": "address:MAC", + "modelType": "address:MAC", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validateAsMAC": true, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.1(1j)-", + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "18456", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvSCrtrn.json b/gen/meta/fvSCrtrn.json new file mode 100644 index 000000000..279395212 --- /dev/null +++ b/gen/meta/fvSCrtrn.json @@ -0,0 +1,752 @@ +{ + "fv:SCrtrn": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "fv:IpAttr": "", + "fv:MacAttr": "", + "fv:ProtoAttr": "", + "fv:SCrtrn": "", + "fv:VmAttr": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "crtrn-": "fv:SCrtrn", + "fd-": "fault:Delegate", + "ipattr-": "fv:IpAttr", + "macattr-": "fv:MacAttr", + "protoattr-": "fv:ProtoAttr", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag", + "vmattr-": "fv:VmAttr" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "crtrn-{name}", + "containedBy": { + "fv:Crtrn": "", + "fv:SCrtrn": "" + }, + "superClasses": [ + "fv:ASCrtrn", + "fv:ACrRule", + "fv:AClassifier", + "fv:Def", + "pol:DefRoot", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "readAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4214195": "creation||fv:SCrtrn", + "E4214196": "modification||fv:SCrtrn", + "E4214197": "deletion||fv:SCrtrn" + }, + "stats": { + + }, + "versions": "1.2(1i)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "6867", + "className": "SCrtrn", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "Sub-Criterion", + "comment": [ + "Sub-Criterion" + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38240", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition root." + ], + "isConfigurable": true, + "propGlobalId": "5614", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40379", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "match": { + "versions": "1.2(1i)-", + "isConfigurable": true, + "propGlobalId": "20374", + "propLocalId": "5227", + "label": "Matching Rule Type", + "baseType": "scalar:Enum8", + "modelType": "fv:MatchT", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "1", "localName": "all", + "platformFlavors": [ + + ], + "label": "Match All "}, + { "value": "0", "localName": "any", + "platformFlavors": [ + + ], + "label": "Match Any "}, + { "value": "any", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "any", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.2(1i)-", + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "20382", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvVmAttr.json b/gen/meta/fvVmAttr.json new file mode 100644 index 000000000..497fb1fc0 --- /dev/null +++ b/gen/meta/fvVmAttr.json @@ -0,0 +1,949 @@ +{ + "fv:VmAttr": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "vmattr-{name}", + "containedBy": { + "fv:Crtrn": "", + "fv:SCrtrn": "" + }, + "superClasses": [ + "fv:AVmAttr", + "fv:AStAttr", + "fv:Attr", + "fv:Def", + "pol:DefRoot", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/vmattr-{name}", + "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name}" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "readAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4214204": "creation||fv:VmAttr", + "E4214205": "modification||fv:VmAttr", + "E4214206": "deletion||fv:VmAttr" + }, + "stats": { + + }, + "versions": "1.1(1j)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "6194", + "className": "VmAttr", + "classPkg": "fv", + "featureTag": "", + "moCategory": "Regular", + "label": "VM Attribute", + "comment": [ + "The virtual attributes in the criterion." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38210", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "category": { + "versions": "2.3(1e)-", + "comment": [ + "The category name. This is the name of the grouping used when calculating the healthscore. If unspecified, the child's class name is used." + ], + "isConfigurable": true, + "propGlobalId": "30032", + "propLocalId": "769", + "label": "Tag Category", + "baseType": "string:Basic", + "modelType": "string:Basic", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 512 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition root." + ], + "isConfigurable": true, + "propGlobalId": "5614", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40349", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "labelName": { + "versions": "1.1(1j)-", + "comment": [ + "The attribute label name." + ], + "isConfigurable": true, + "propGlobalId": "19813", + "propLocalId": "5133", + "label": "Custom Attribute Name", + "baseType": "string:Basic", + "modelType": "string:Basic", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 512 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.1(1j)-", + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "18460", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "operator": { + "versions": "1.1(1j)-", + "comment": [ + "The operator type for the attribute." + ], + "isConfigurable": true, + "propGlobalId": "18436", + "propLocalId": "4739", + "label": "Operator", + "baseType": "scalar:Enum8", + "modelType": "fv:OperT", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "1", "localName": "contains", + "platformFlavors": [ + + ], + "label": "Contains "}, + { "value": "equals", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "endsWith", + "platformFlavors": [ + + ], + "label": "Ends With "}, + { "value": "0", "localName": "equals", + "platformFlavors": [ + + ], + "label": "Equals "}, + { "value": "4", "localName": "notEquals", + "platformFlavors": [ + + ], + "label": "Not Equals "}, + { "value": "2", "localName": "startsWith", + "platformFlavors": [ + + ], + "label": "Starts With "} + ], + "default": "equals", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "type": { + "versions": "1.1(1j)-", + "comment": [ + "The attribute type." + ], + "isConfigurable": true, + "propGlobalId": "18435", + "propLocalId": "33", + "label": "Attribute Type", + "baseType": "scalar:Enum8", + "modelType": "fv:VmAttrT", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "7", "localName": "custom-label", + "platformFlavors": [ + + ], + "label": "Custom Attribute "}, + { "value": "vm-name", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "5", "localName": "domain", + "platformFlavors": [ + + ], + "label": "VMM Domain "}, + { "value": "1", "localName": "guest-os", + "platformFlavors": [ + + ], + "label": "Operating System "}, + { "value": "2", "localName": "hv", + "platformFlavors": [ + + ], + "label": "Hypervisor Identifier "}, + { "value": "6", "localName": "rootContName", + "platformFlavors": [ + + ], + "label": "Datacenter "}, + { "value": "8", "localName": "tag", + "platformFlavors": [ + + ], + "label": "Tag "}, + { "value": "3", "localName": "vm", + "platformFlavors": [ + + ], + "label": "VM Identifier "}, + { "value": "9", "localName": "vm-folder", + "platformFlavors": [ + + ], + "label": "VM Folder "}, + { "value": "0", "localName": "vm-name", + "platformFlavors": [ + + ], + "label": "VM Name "}, + { "value": "10", "localName": "vmfolder-path", + "platformFlavors": [ + + ], + "label": "VM Folder Path "}, + { "value": "4", "localName": "vnic", + "platformFlavors": [ + + ], + "label": "VNIC DN "} + ], + "default": "vm-name", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "value": { + "versions": "1.1(1j)-", + "comment": [ + "The assigned number value of the attribute." + ], + "isConfigurable": true, + "propGlobalId": "18437", + "propLocalId": "1631", + "label": "Custom Attribute Value or Tag Name", + "baseType": "string:Basic", + "modelType": "string:Basic", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 512 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/templates/datasource_test.go.tmpl b/gen/templates/datasource_test.go.tmpl index 496d6039a..96bdd28e7 100644 --- a/gen/templates/datasource_test.go.tmpl +++ b/gen/templates/datasource_test.go.tmpl @@ -100,7 +100,7 @@ data "aci_{{$.resourceName}}" "test" { } ` -const testConfig{{$.resourceClassName}}NotExisting{{capitalize .class_name}} = testConfig{{$.resourceClassName}}MinDependencyWith{{capitalize .class_name}} + ` +const testConfig{{$.resourceClassName}}NotExisting{{capitalize .class_name}} = testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` data "aci_{{$.resourceName}}" "test_non_existing" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.datasource_non_existing}} @@ -110,7 +110,6 @@ data "aci_{{$.resourceName}}" "test_non_existing" { {{$key}} = "{{$value}}" {{- end }} {{- end}} - depends_on = [aci_{{$.resourceName}}.test] } ` {{- end}} diff --git a/gen/testvars/fvCrtrn.yaml b/gen/testvars/fvCrtrn.yaml new file mode 100644 index 000000000..534b7d913 --- /dev/null +++ b/gen/testvars/fvCrtrn.yaml @@ -0,0 +1,52 @@ +# Code generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +default: + annotation: "orchestrator:terraform" + description: "" + match: "any" + name: "" + name_alias: "" + owner_key: "" + owner_tag: "" + precedence: "0" + scope: "scope-bd" + +datasource_non_existing: + +datasource_required: + +resource_required: + +all: + annotation: "annotation" + description: "description" + match: "all" + name: "criterion" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + precedence: "1" + scope: "scope-bd" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + +parents: + - class_name: "fvAEPg" + parent_dependency: "" + parent_dn: "aci_application_epg.test.id" + class_in_parent: false diff --git a/gen/testvars/fvDnsAttr.yaml b/gen/testvars/fvDnsAttr.yaml new file mode 100644 index 000000000..4d170f77c --- /dev/null +++ b/gen/testvars/fvDnsAttr.yaml @@ -0,0 +1,49 @@ +# Code generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +default: + annotation: "orchestrator:terraform" + description: "" + filter: "" + name_alias: "" + owner_key: "" + owner_tag: "" + +datasource_non_existing: + name: "dns_attribute_non_existing" + +datasource_required: + name: "dns_attribute" + +resource_required: + name: "dns_attribute" + +all: + annotation: "annotation" + description: "description" + filter: "filter" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + +parents: + - class_name: "fvCrtrn" + parent_dependency: "" + parent_dn: "aci_epg_useg_criterion.test.id" + class_in_parent: false diff --git a/gen/testvars/fvIdGroupAttr.yaml b/gen/testvars/fvIdGroupAttr.yaml new file mode 100644 index 000000000..443ffb3af --- /dev/null +++ b/gen/testvars/fvIdGroupAttr.yaml @@ -0,0 +1,49 @@ +# Code generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +default: + annotation: "orchestrator:terraform" + description: "" + name: "" + name_alias: "" + owner_key: "" + owner_tag: "" + +datasource_non_existing: + selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng_non_existing" + +datasource_required: + selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + +resource_required: + selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + +all: + annotation: "annotation" + description: "description" + name: "name" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + +parents: + - class_name: "fvCrtrn" + parent_dependency: "" + parent_dn: "aci_epg_useg_criterion.test.id" + class_in_parent: false diff --git a/gen/testvars/fvIpAttr.yaml b/gen/testvars/fvIpAttr.yaml new file mode 100644 index 000000000..f775617b0 --- /dev/null +++ b/gen/testvars/fvIpAttr.yaml @@ -0,0 +1,52 @@ +# Code generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +default: + annotation: "orchestrator:terraform" + description: "" + ip: "131.107.1.200" + name_alias: "" + owner_key: "" + owner_tag: "" + use_fv_subnet: "no" + +datasource_non_existing: + name: "131_non_existing" + +datasource_required: + name: "131" + +resource_required: + ip: "131.107.1.200" + name: "131" + +all: + annotation: "annotation" + description: "description" + ip: "0.0.0.0" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + use_fv_subnet: "yes" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + +parents: + - class_name: "fvCrtrn" + parent_dependency: "" + parent_dn: "aci_epg_useg_criterion.test.id" + class_in_parent: false diff --git a/gen/testvars/fvMacAttr.yaml b/gen/testvars/fvMacAttr.yaml new file mode 100644 index 000000000..643eb6ff8 --- /dev/null +++ b/gen/testvars/fvMacAttr.yaml @@ -0,0 +1,50 @@ +# Code generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +default: + annotation: "orchestrator:terraform" + description: "" + mac: "AA:BB:CC:DD:EE:FF" + name_alias: "" + owner_key: "" + owner_tag: "" + +datasource_non_existing: + name: "mac_attr_non_existing" + +datasource_required: + name: "mac_attr" + +resource_required: + mac: "AA:BB:CC:DD:EE:FF" + name: "mac_attr" + +all: + annotation: "annotation" + description: "description" + mac: "AA:BB:CC:BB:BB:EE" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + +parents: + - class_name: "fvCrtrn" + parent_dependency: "" + parent_dn: "aci_epg_useg_criterion.test.id" + class_in_parent: false diff --git a/gen/testvars/fvSCrtrn.yaml b/gen/testvars/fvSCrtrn.yaml new file mode 100644 index 000000000..a761f7cfa --- /dev/null +++ b/gen/testvars/fvSCrtrn.yaml @@ -0,0 +1,49 @@ +# Code generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +default: + annotation: "orchestrator:terraform" + description: "" + match: "any" + name_alias: "" + owner_key: "" + owner_tag: "" + +datasource_non_existing: + name: "sub_criterion_non_existing" + +datasource_required: + name: "sub_criterion" + +resource_required: + name: "sub_criterion" + +all: + annotation: "annotation" + description: "description" + match: "all" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + +parents: + - class_name: "fvCrtrn" + parent_dependency: "" + parent_dn: "aci_epg_useg_criterion.test.id" + class_in_parent: false diff --git a/gen/testvars/fvVmAttr.yaml b/gen/testvars/fvVmAttr.yaml new file mode 100644 index 000000000..9cedb3ca1 --- /dev/null +++ b/gen/testvars/fvVmAttr.yaml @@ -0,0 +1,62 @@ +# Code generated by "gen/generator.go"; DO NOT EDIT. +# In order to regenerate this file execute `go generate` from the repository root. +# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +default: + annotation: "orchestrator:terraform" + category: "" + description: "" + label_name: "" + name_alias: "" + operator: "equals" + owner_key: "" + owner_tag: "" + type: "vm-name" + value: "default_value" + +datasource_non_existing: + name: "vm_attribute_non_existing" + +datasource_required: + name: "vm_attribute" + +resource_required: + name: "vm_attribute" + value: "default_value" + +all: + annotation: "annotation" + category: "all_category" + description: "description" + label_name: "label_name" + name_alias: "name_alias" + operator: "contains" + owner_key: "owner_key" + owner_tag: "owner_tag" + type: "domain" + value: "all_value" + +children: + annotations: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + + tags: + - key: "key_0" + value: "value_1" + + - key: "key_1" + value: "value_2" + +parents: + - class_name: "fvCrtrn" + parent_dependency: "" + parent_dn: "aci_epg_useg_criterion.test.id" + class_in_parent: false + - class_name: "fvSCrtrn" + parent_dependency: "" + parent_dn: "aci_epg_useg_sub_criterion.test.id" + class_in_parent: false diff --git a/internal/provider/data_source_aci_annotation_test.go b/internal/provider/data_source_aci_annotation_test.go index a7c9df9d7..77efa0a62 100644 --- a/internal/provider/data_source_aci_annotation_test.go +++ b/internal/provider/data_source_aci_annotation_test.go @@ -62,11 +62,10 @@ data "aci_annotation" "test" { } ` -const testConfigTagAnnotationNotExistingFvTenant = testConfigTagAnnotationMinDependencyWithFvTenant + ` +const testConfigTagAnnotationNotExistingFvTenant = testConfigFvTenantMin + ` data "aci_annotation" "test_non_existing" { parent_dn = aci_tenant.test.id key = "non_existing_key" - depends_on = [aci_annotation.test] } ` const testConfigTagAnnotationDataSourceDependencyWithFvAEPg = testConfigTagAnnotationMinDependencyWithFvAEPg + ` @@ -77,10 +76,9 @@ data "aci_annotation" "test" { } ` -const testConfigTagAnnotationNotExistingFvAEPg = testConfigTagAnnotationMinDependencyWithFvAEPg + ` +const testConfigTagAnnotationNotExistingFvAEPg = testConfigFvAEPgMin + ` data "aci_annotation" "test_non_existing" { parent_dn = aci_application_epg.test.id key = "non_existing_key" - depends_on = [aci_annotation.test] } ` diff --git a/internal/provider/data_source_aci_endpoint_tag_ip.go b/internal/provider/data_source_aci_endpoint_tag_ip.go index 7c1bf4a91..297fe97c9 100644 --- a/internal/provider/data_source_aci_endpoint_tag_ip.go +++ b/internal/provider/data_source_aci_endpoint_tag_ip.go @@ -42,7 +42,7 @@ func (d *FvEpIpTagDataSource) Schema(ctx context.Context, req datasource.SchemaR Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag Ip object.", + MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag IP object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,27 +50,27 @@ func (d *FvEpIpTagDataSource) Schema(ctx context.Context, req datasource.SchemaR }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the Endpoint Tag Ip object.`, + MarkdownDescription: `The annotation of the Endpoint Tag IP object.`, }, "vrf_name": schema.StringAttribute{ Required: true, - MarkdownDescription: `The VRF name of the Endpoint Tag Ip object.`, + MarkdownDescription: `The VRF name of the Endpoint Tag IP object.`, }, "id_attribute": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The identifier of the Endpoint Tag Ip object.`, + MarkdownDescription: `The identifier of the Endpoint Tag IP object.`, }, "ip": schema.StringAttribute{ Required: true, - MarkdownDescription: `The IP address of the Endpoint Tag Ip object.`, + MarkdownDescription: `The IP address of the Endpoint Tag IP object.`, }, "name": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name of the Endpoint Tag Ip object.`, + MarkdownDescription: `The name of the Endpoint Tag IP object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the Endpoint Tag Ip object.`, + MarkdownDescription: `The name alias of the Endpoint Tag IP object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, diff --git a/internal/provider/data_source_aci_endpoint_tag_ip_test.go b/internal/provider/data_source_aci_endpoint_tag_ip_test.go index 1e4c5ca23..66a4eff33 100644 --- a/internal/provider/data_source_aci_endpoint_tag_ip_test.go +++ b/internal/provider/data_source_aci_endpoint_tag_ip_test.go @@ -46,11 +46,10 @@ data "aci_endpoint_tag_ip" "test" { } ` -const testConfigFvEpIpTagNotExistingFvTenant = testConfigFvEpIpTagMinDependencyWithFvTenant + ` +const testConfigFvEpIpTagNotExistingFvTenant = testConfigFvTenantMin + ` data "aci_endpoint_tag_ip" "test_non_existing" { parent_dn = aci_tenant.test.id ip = "10.0.1.2" vrf_name = "non_existing_ctx_name" - depends_on = [aci_endpoint_tag_ip.test] } ` diff --git a/internal/provider/data_source_aci_endpoint_tag_mac.go b/internal/provider/data_source_aci_endpoint_tag_mac.go index 20681e3c3..0c340436c 100644 --- a/internal/provider/data_source_aci_endpoint_tag_mac.go +++ b/internal/provider/data_source_aci_endpoint_tag_mac.go @@ -42,7 +42,7 @@ func (d *FvEpMacTagDataSource) Schema(ctx context.Context, req datasource.Schema Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag Mac object.", + MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag MAC object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,27 +50,27 @@ func (d *FvEpMacTagDataSource) Schema(ctx context.Context, req datasource.Schema }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the Endpoint Tag Mac object.`, + MarkdownDescription: `The annotation of the Endpoint Tag MAC object.`, }, "bd_name": schema.StringAttribute{ Required: true, - MarkdownDescription: `The bridge domain name of the Endpoint Tag Mac object.`, + MarkdownDescription: `The bridge domain name of the Endpoint Tag MAC object.`, }, "id_attribute": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The identifier of the Endpoint Tag Mac object.`, + MarkdownDescription: `The identifier of the Endpoint Tag MAC object.`, }, "mac": schema.StringAttribute{ Required: true, - MarkdownDescription: `The MAC address of the Endpoint Tag Mac object.`, + MarkdownDescription: `The MAC address of the Endpoint Tag MAC object.`, }, "name": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name of the Endpoint Tag Mac object.`, + MarkdownDescription: `The name of the Endpoint Tag MAC object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the Endpoint Tag Mac object.`, + MarkdownDescription: `The name alias of the Endpoint Tag MAC object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, diff --git a/internal/provider/data_source_aci_endpoint_tag_mac_test.go b/internal/provider/data_source_aci_endpoint_tag_mac_test.go index 34e6a3264..9390118cd 100644 --- a/internal/provider/data_source_aci_endpoint_tag_mac_test.go +++ b/internal/provider/data_source_aci_endpoint_tag_mac_test.go @@ -46,11 +46,10 @@ data "aci_endpoint_tag_mac" "test" { } ` -const testConfigFvEpMacTagNotExistingFvTenant = testConfigFvEpMacTagMinDependencyWithFvTenant + ` +const testConfigFvEpMacTagNotExistingFvTenant = testConfigFvTenantMin + ` data "aci_endpoint_tag_mac" "test_non_existing" { parent_dn = aci_tenant.test.id bd_name = "non_existing_bd_name" mac = "00:00:00:00:00:01" - depends_on = [aci_endpoint_tag_mac.test] } ` diff --git a/internal/provider/data_source_aci_epg_useg_criterion.go b/internal/provider/data_source_aci_epg_useg_criterion.go new file mode 100644 index 000000000..fb36a2639 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion.go @@ -0,0 +1,177 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvCrtrnDataSource{} + +func NewFvCrtrnDataSource() datasource.DataSource { + return &FvCrtrnDataSource{} +} + +// FvCrtrnDataSource defines the data source implementation. +type FvCrtrnDataSource struct { + client *client.Client +} + +func (d *FvCrtrnDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion") +} + +func (d *FvCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion datasource for the 'fvCrtrn' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the EPG uSeg Criterion object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the EPG uSeg Criterion object.`, + }, + "match": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Criterion object.`, + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the EPG uSeg Criterion object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the EPG uSeg Criterion object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "precedence": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The precedence of the EPG uSeg Criterion object.`, + }, + "scope": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The scope of the EPG uSeg Criterion object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion") +} + +func (d *FvCrtrnDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion") +} + +func (d *FvCrtrnDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion") + var data *FvCrtrnResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvCrtrnId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvCrtrnAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + + getAndSetFvCrtrnAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_epg_useg_criterion data source", + fmt.Sprintf("The aci_epg_useg_criterion data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute.go b/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute.go new file mode 100644 index 000000000..74edbdbcb --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute.go @@ -0,0 +1,169 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvDnsAttrDataSource{} + +func NewFvDnsAttrDataSource() datasource.DataSource { + return &FvDnsAttrDataSource{} +} + +// FvDnsAttrDataSource defines the data source implementation. +type FvDnsAttrDataSource struct { + client *client.Client +} + +func (d *FvDnsAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_dns_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_dns_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_dns_attribute") +} + +func (d *FvDnsAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_dns_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_dns_attribute datasource for the 'fvDnsAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the EPG uSeg Criterion DNS Attribute object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the EPG uSeg Criterion DNS Attribute object.`, + }, + "filter": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The domain name filter of the EPG uSeg Criterion DNS Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the EPG uSeg Criterion DNS Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the EPG uSeg Criterion DNS Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_dns_attribute") +} + +func (d *FvDnsAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_dns_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_dns_attribute") +} + +func (d *FvDnsAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_dns_attribute") + var data *FvDnsAttrResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvDnsAttrId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvDnsAttrAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvDnsAttrAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_epg_useg_criterion_dns_attribute data source", + fmt.Sprintf("The aci_epg_useg_criterion_dns_attribute data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute_test.go b/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute_test.go new file mode 100644 index 000000000..bae4d8cba --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute_test.go @@ -0,0 +1,54 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvDnsAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvDnsAttrDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), + ), + }, + { + Config: testConfigFvDnsAttrNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_dns_attribute data source"), + }, + }, + }) +} + +const testConfigFvDnsAttrDataSourceDependencyWithFvCrtrn = testConfigFvDnsAttrMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" + depends_on = [aci_epg_useg_criterion_dns_attribute.test] +} +` + +const testConfigFvDnsAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` +data "aci_epg_useg_criterion_dns_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute_non_existing" +} +` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute.go b/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute.go new file mode 100644 index 000000000..7394f7b2e --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute.go @@ -0,0 +1,169 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvIdGroupAttrDataSource{} + +func NewFvIdGroupAttrDataSource() datasource.DataSource { + return &FvIdGroupAttrDataSource{} +} + +// FvIdGroupAttrDataSource defines the data source implementation. +type FvIdGroupAttrDataSource struct { + client *client.Client +} + +func (d *FvIdGroupAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_identity_group_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_identity_group_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_identity_group_attribute") +} + +func (d *FvIdGroupAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_identity_group_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_identity_group_attribute datasource for the 'fvIdGroupAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "selector": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_identity_group_attribute") +} + +func (d *FvIdGroupAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_identity_group_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_identity_group_attribute") +} + +func (d *FvIdGroupAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_identity_group_attribute") + var data *FvIdGroupAttrResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvIdGroupAttrId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvIdGroupAttrAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvIdGroupAttrAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_epg_useg_criterion_identity_group_attribute data source", + fmt.Sprintf("The aci_epg_useg_criterion_identity_group_attribute data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute_test.go b/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute_test.go new file mode 100644 index 000000000..7d5b5cbdf --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute_test.go @@ -0,0 +1,54 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvIdGroupAttrDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), + ), + }, + { + Config: testConfigFvIdGroupAttrNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_identity_group_attribute data source"), + }, + }, + }) +} + +const testConfigFvIdGroupAttrDataSourceDependencyWithFvCrtrn = testConfigFvIdGroupAttrMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + depends_on = [aci_epg_useg_criterion_identity_group_attribute.test] +} +` + +const testConfigFvIdGroupAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` +data "aci_epg_useg_criterion_identity_group_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng_non_existing" +} +` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute.go b/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute.go new file mode 100644 index 000000000..7394310de --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute.go @@ -0,0 +1,173 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvIpAttrDataSource{} + +func NewFvIpAttrDataSource() datasource.DataSource { + return &FvIpAttrDataSource{} +} + +// FvIpAttrDataSource defines the data source implementation. +type FvIpAttrDataSource struct { + client *client.Client +} + +func (d *FvIpAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_ip_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_ip_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_ip_attribute") +} + +func (d *FvIpAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_ip_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_ip_attribute datasource for the 'fvIpAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the EPG uSeg Criterion IP Attribute object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the EPG uSeg Criterion IP Attribute object.`, + }, + "ip": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The device IP address of the EPG uSeg Criterion IP Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the EPG uSeg Criterion IP Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the EPG uSeg Criterion IP Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "use_fv_subnet": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_ip_attribute") +} + +func (d *FvIpAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_ip_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_ip_attribute") +} + +func (d *FvIpAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_ip_attribute") + var data *FvIpAttrResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvIpAttrId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvIpAttrAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvIpAttrAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_epg_useg_criterion_ip_attribute data source", + fmt.Sprintf("The aci_epg_useg_criterion_ip_attribute data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute_test.go b/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute_test.go new file mode 100644 index 000000000..68eed806c --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute_test.go @@ -0,0 +1,55 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvIpAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvIpAttrDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + { + Config: testConfigFvIpAttrNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_ip_attribute data source"), + }, + }, + }) +} + +const testConfigFvIpAttrDataSourceDependencyWithFvCrtrn = testConfigFvIpAttrMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "131" + depends_on = [aci_epg_useg_criterion_ip_attribute.test] +} +` + +const testConfigFvIpAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` +data "aci_epg_useg_criterion_ip_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_criterion.test.id + name = "131_non_existing" +} +` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute.go b/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute.go new file mode 100644 index 000000000..7f9d60e24 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute.go @@ -0,0 +1,169 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvMacAttrDataSource{} + +func NewFvMacAttrDataSource() datasource.DataSource { + return &FvMacAttrDataSource{} +} + +// FvMacAttrDataSource defines the data source implementation. +type FvMacAttrDataSource struct { + client *client.Client +} + +func (d *FvMacAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_mac_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_mac_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_mac_attribute") +} + +func (d *FvMacAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_mac_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_mac_attribute datasource for the 'fvMacAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the EPG uSeg Criterion MAC Attribute object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the EPG uSeg Criterion MAC Attribute object.`, + }, + "mac": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The MAC address of the EPG uSeg Criterion MAC Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the EPG uSeg Criterion MAC Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the EPG uSeg Criterion MAC Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_mac_attribute") +} + +func (d *FvMacAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_mac_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_mac_attribute") +} + +func (d *FvMacAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_mac_attribute") + var data *FvMacAttrResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvMacAttrId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvMacAttrAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvMacAttrAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_epg_useg_criterion_mac_attribute data source", + fmt.Sprintf("The aci_epg_useg_criterion_mac_attribute data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute_test.go b/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute_test.go new file mode 100644 index 000000000..ef975cc93 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute_test.go @@ -0,0 +1,54 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvMacAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvMacAttrDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), + ), + }, + { + Config: testConfigFvMacAttrNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_mac_attribute data source"), + }, + }, + }) +} + +const testConfigFvMacAttrDataSourceDependencyWithFvCrtrn = testConfigFvMacAttrMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "mac_attr" + depends_on = [aci_epg_useg_criterion_mac_attribute.test] +} +` + +const testConfigFvMacAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` +data "aci_epg_useg_criterion_mac_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_criterion.test.id + name = "mac_attr_non_existing" +} +` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_test.go b/internal/provider/data_source_aci_epg_useg_criterion_test.go new file mode 100644 index 000000000..165f5a50a --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_test.go @@ -0,0 +1,54 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvCrtrnWithFvAEPg(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvCrtrnDataSourceDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "precedence", "0"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "scope", "scope-bd"), + ), + }, + { + Config: testConfigFvCrtrnNotExistingFvAEPg, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion data source"), + }, + }, + }) +} + +const testConfigFvCrtrnDataSourceDependencyWithFvAEPg = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +data "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id + depends_on = [aci_epg_useg_criterion.test] +} +` + +const testConfigFvCrtrnNotExistingFvAEPg = testConfigFvAEPgMin + ` +data "aci_epg_useg_criterion" "test_non_existing" { + parent_dn = aci_application_epg.test.id +} +` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute.go b/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute.go new file mode 100644 index 000000000..4f60662f5 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute.go @@ -0,0 +1,185 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvVmAttrDataSource{} + +func NewFvVmAttrDataSource() datasource.DataSource { + return &FvVmAttrDataSource{} +} + +// FvVmAttrDataSource defines the data source implementation. +type FvVmAttrDataSource struct { + client *client.Client +} + +func (d *FvVmAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_vm_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_vm_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_vm_attribute") +} + +func (d *FvVmAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_vm_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_vm_attribute datasource for the 'fvVmAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the EPG uSeg Criterion VM Attribute object.`, + }, + "category": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The category of the EPG uSeg Criterion VM Attribute object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the EPG uSeg Criterion VM Attribute object.`, + }, + "label_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The label name of the EPG uSeg Criterion VM Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the EPG uSeg Criterion VM Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the EPG uSeg Criterion VM Attribute object.`, + }, + "operator": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The operator of the EPG uSeg Criterion VM Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "type": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The type of the EPG uSeg Criterion VM Attribute object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the EPG uSeg Criterion VM Attribute object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_vm_attribute") +} + +func (d *FvVmAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_vm_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_vm_attribute") +} + +func (d *FvVmAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_vm_attribute") + var data *FvVmAttrResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvVmAttrId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvVmAttrAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvVmAttrAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_epg_useg_criterion_vm_attribute data source", + fmt.Sprintf("The aci_epg_useg_criterion_vm_attribute data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute_test.go b/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute_test.go new file mode 100644 index 000000000..38d78c40e --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute_test.go @@ -0,0 +1,102 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvVmAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvVmAttrDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + ), + }, + { + Config: testConfigFvVmAttrNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_vm_attribute data source"), + }, + }, + }) +} +func TestAccDataSourceFvVmAttrWithFvSCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvVmAttrDataSourceDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + ), + }, + { + Config: testConfigFvVmAttrNotExistingFvSCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_vm_attribute data source"), + }, + }, + }) +} + +const testConfigFvVmAttrDataSourceDependencyWithFvCrtrn = testConfigFvVmAttrMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + depends_on = [aci_epg_useg_criterion_vm_attribute.test] +} +` + +const testConfigFvVmAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` +data "aci_epg_useg_criterion_vm_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute_non_existing" +} +` +const testConfigFvVmAttrDataSourceDependencyWithFvSCrtrn = testConfigFvVmAttrMinDependencyWithFvSCrtrn + ` +data "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + depends_on = [aci_epg_useg_criterion_vm_attribute.test] +} +` + +const testConfigFvVmAttrNotExistingFvSCrtrn = testConfigFvSCrtrnMin + ` +data "aci_epg_useg_criterion_vm_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute_non_existing" +} +` diff --git a/internal/provider/data_source_aci_epg_useg_sub_criterion.go b/internal/provider/data_source_aci_epg_useg_sub_criterion.go new file mode 100644 index 000000000..f3e831d57 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_sub_criterion.go @@ -0,0 +1,169 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvSCrtrnDataSource{} + +func NewFvSCrtrnDataSource() datasource.DataSource { + return &FvSCrtrnDataSource{} +} + +// FvSCrtrnDataSource defines the data source implementation. +type FvSCrtrnDataSource struct { + client *client.Client +} + +func (d *FvSCrtrnDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_sub_criterion") + resp.TypeName = req.ProviderTypeName + "_epg_useg_sub_criterion" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_sub_criterion") +} + +func (d *FvSCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_sub_criterion") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_sub_criterion datasource for the 'fvSCrtrn' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Sub Criterion object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the EPG uSeg Sub Criterion object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the EPG uSeg Sub Criterion object.`, + }, + "match": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Sub Criterion object.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the EPG uSeg Sub Criterion object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the EPG uSeg Sub Criterion object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_sub_criterion") +} + +func (d *FvSCrtrnDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_sub_criterion") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_sub_criterion") +} + +func (d *FvSCrtrnDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_sub_criterion") + var data *FvSCrtrnResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvSCrtrnId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvSCrtrnAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + + getAndSetFvSCrtrnAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_epg_useg_sub_criterion data source", + fmt.Sprintf("The aci_epg_useg_sub_criterion data source with id '%s' has not been found", cachedId), + ) + return + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_epg_useg_sub_criterion_test.go b/internal/provider/data_source_aci_epg_useg_sub_criterion_test.go new file mode 100644 index 000000000..e74440e61 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_sub_criterion_test.go @@ -0,0 +1,54 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvSCrtrnWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvSCrtrnDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "owner_tag", ""), + ), + }, + { + Config: testConfigFvSCrtrnNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_sub_criterion data source"), + }, + }, + }) +} + +const testConfigFvSCrtrnDataSourceDependencyWithFvCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" + depends_on = [aci_epg_useg_sub_criterion.test] +} +` + +const testConfigFvSCrtrnNotExistingFvCrtrn = testConfigFvCrtrnMin + ` +data "aci_epg_useg_sub_criterion" "test_non_existing" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion_non_existing" +} +` diff --git a/internal/provider/data_source_aci_external_management_network_subnet_test.go b/internal/provider/data_source_aci_external_management_network_subnet_test.go index 841afdc32..cdfbaf8ae 100644 --- a/internal/provider/data_source_aci_external_management_network_subnet_test.go +++ b/internal/provider/data_source_aci_external_management_network_subnet_test.go @@ -44,10 +44,9 @@ data "aci_external_management_network_subnet" "test" { } ` -const testConfigMgmtSubnetNotExistingMgmtInstP = testConfigMgmtSubnetMinDependencyWithMgmtInstP + ` +const testConfigMgmtSubnetNotExistingMgmtInstP = testConfigMgmtInstPMin + ` data "aci_external_management_network_subnet" "test_non_existing" { parent_dn = aci_external_management_network_instance_profile.test.id ip = "2.2.2.0/24" - depends_on = [aci_external_management_network_subnet.test] } ` diff --git a/internal/provider/data_source_aci_l3out_consumer_label_test.go b/internal/provider/data_source_aci_l3out_consumer_label_test.go index b77e57c10..5811e8648 100644 --- a/internal/provider/data_source_aci_l3out_consumer_label_test.go +++ b/internal/provider/data_source_aci_l3out_consumer_label_test.go @@ -47,10 +47,9 @@ data "aci_l3out_consumer_label" "test" { } ` -const testConfigL3extConsLblNotExistingL3extOut = testConfigL3extConsLblMinDependencyWithL3extOut + ` +const testConfigL3extConsLblNotExistingL3extOut = testConfigL3extOutMin + ` data "aci_l3out_consumer_label" "test_non_existing" { parent_dn = aci_l3_outside.test.id name = "non_existing_name" - depends_on = [aci_l3out_consumer_label.test] } ` diff --git a/internal/provider/data_source_aci_l3out_node_sid_profile_test.go b/internal/provider/data_source_aci_l3out_node_sid_profile_test.go index 76a85fd54..29634bab1 100644 --- a/internal/provider/data_source_aci_l3out_node_sid_profile_test.go +++ b/internal/provider/data_source_aci_l3out_node_sid_profile_test.go @@ -45,10 +45,9 @@ data "aci_l3out_node_sid_profile" "test" { } ` -const testConfigMplsNodeSidPNotExistingL3extLoopBackIfP = testConfigMplsNodeSidPMinDependencyWithL3extLoopBackIfP + ` +const testConfigMplsNodeSidPNotExistingL3extLoopBackIfP = testConfigL3extLoopBackIfPMinDependencyWithL3extRsNodeL3OutAtt + ` data "aci_l3out_node_sid_profile" "test_non_existing" { parent_dn = aci_l3out_loopback_interface_profile.test.id segment_id = "2" - depends_on = [aci_l3out_node_sid_profile.test] } ` diff --git a/internal/provider/data_source_aci_l3out_provider_label_test.go b/internal/provider/data_source_aci_l3out_provider_label_test.go index fa00bca3e..a37b73b5e 100644 --- a/internal/provider/data_source_aci_l3out_provider_label_test.go +++ b/internal/provider/data_source_aci_l3out_provider_label_test.go @@ -46,10 +46,9 @@ data "aci_l3out_provider_label" "test" { } ` -const testConfigL3extProvLblNotExistingL3extOut = testConfigL3extProvLblMinDependencyWithL3extOut + ` +const testConfigL3extProvLblNotExistingL3extOut = testConfigL3extOutMinDependencyWithFvTenantInfra + ` data "aci_l3out_provider_label" "test_non_existing" { parent_dn = aci_l3_outside.test.id name = "prov_label_non_existing" - depends_on = [aci_l3out_provider_label.test] } ` diff --git a/internal/provider/data_source_aci_l3out_redistribute_policy_test.go b/internal/provider/data_source_aci_l3out_redistribute_policy_test.go index 5bcc81642..48ba80197 100644 --- a/internal/provider/data_source_aci_l3out_redistribute_policy_test.go +++ b/internal/provider/data_source_aci_l3out_redistribute_policy_test.go @@ -44,11 +44,10 @@ data "aci_l3out_redistribute_policy" "test" { } ` -const testConfigL3extRsRedistributePolNotExistingL3extOut = testConfigL3extRsRedistributePolMinDependencyWithL3extOut + ` +const testConfigL3extRsRedistributePolNotExistingL3extOut = testConfigL3extOutMinDependencyWithFvTenant + ` data "aci_l3out_redistribute_policy" "test_non_existing" { parent_dn = aci_l3_outside.test.id route_control_profile_name = "non_existing_tn_rtctrl_profile_name" source = "static" - depends_on = [aci_l3out_redistribute_policy.test] } ` diff --git a/internal/provider/data_source_aci_netflow_monitor_policy_test.go b/internal/provider/data_source_aci_netflow_monitor_policy_test.go index 7af9046b2..5cfc3948a 100644 --- a/internal/provider/data_source_aci_netflow_monitor_policy_test.go +++ b/internal/provider/data_source_aci_netflow_monitor_policy_test.go @@ -45,10 +45,9 @@ data "aci_netflow_monitor_policy" "test" { } ` -const testConfigNetflowMonitorPolNotExistingFvTenant = testConfigNetflowMonitorPolMinDependencyWithFvTenant + ` +const testConfigNetflowMonitorPolNotExistingFvTenant = testConfigFvTenantMin + ` data "aci_netflow_monitor_policy" "test_non_existing" { parent_dn = aci_tenant.test.id name = "netfow_monitor_non_existing" - depends_on = [aci_netflow_monitor_policy.test] } ` diff --git a/internal/provider/data_source_aci_pim_route_map_entry_test.go b/internal/provider/data_source_aci_pim_route_map_entry_test.go index 601ec2d8b..777403a1e 100644 --- a/internal/provider/data_source_aci_pim_route_map_entry_test.go +++ b/internal/provider/data_source_aci_pim_route_map_entry_test.go @@ -48,10 +48,9 @@ data "aci_pim_route_map_entry" "test" { } ` -const testConfigPimRouteMapEntryNotExistingPimRouteMapPol = testConfigPimRouteMapEntryMinDependencyWithPimRouteMapPol + ` +const testConfigPimRouteMapEntryNotExistingPimRouteMapPol = testConfigPimRouteMapPolMinDependencyWithFvTenant + ` data "aci_pim_route_map_entry" "test_non_existing" { parent_dn = aci_pim_route_map_policy.test.id order = "2" - depends_on = [aci_pim_route_map_entry.test] } ` diff --git a/internal/provider/data_source_aci_pim_route_map_policy_test.go b/internal/provider/data_source_aci_pim_route_map_policy_test.go index 69b8daa95..0220f8f03 100644 --- a/internal/provider/data_source_aci_pim_route_map_policy_test.go +++ b/internal/provider/data_source_aci_pim_route_map_policy_test.go @@ -45,10 +45,9 @@ data "aci_pim_route_map_policy" "test" { } ` -const testConfigPimRouteMapPolNotExistingFvTenant = testConfigPimRouteMapPolMinDependencyWithFvTenant + ` +const testConfigPimRouteMapPolNotExistingFvTenant = testConfigFvTenantMin + ` data "aci_pim_route_map_policy" "test_non_existing" { parent_dn = aci_tenant.test.id name = "non_existing_name" - depends_on = [aci_pim_route_map_policy.test] } ` diff --git a/internal/provider/data_source_aci_relation_to_consumed_out_of_band_contract_test.go b/internal/provider/data_source_aci_relation_to_consumed_out_of_band_contract_test.go index c935ea7d2..e3bc93845 100644 --- a/internal/provider/data_source_aci_relation_to_consumed_out_of_band_contract_test.go +++ b/internal/provider/data_source_aci_relation_to_consumed_out_of_band_contract_test.go @@ -42,10 +42,9 @@ data "aci_relation_to_consumed_out_of_band_contract" "test" { } ` -const testConfigMgmtRsOoBConsNotExistingMgmtInstP = testConfigMgmtRsOoBConsMinDependencyWithMgmtInstP + ` +const testConfigMgmtRsOoBConsNotExistingMgmtInstP = testConfigMgmtInstPMin + ` data "aci_relation_to_consumed_out_of_band_contract" "test_non_existing" { parent_dn = aci_external_management_network_instance_profile.test.id out_of_band_contract_name = "non_existing_tn_vz_oob_br_cp_name" - depends_on = [aci_relation_to_consumed_out_of_band_contract.test] } ` diff --git a/internal/provider/data_source_aci_relation_to_fallback_route_group_test.go b/internal/provider/data_source_aci_relation_to_fallback_route_group_test.go index 8795e178a..1805cb200 100644 --- a/internal/provider/data_source_aci_relation_to_fallback_route_group_test.go +++ b/internal/provider/data_source_aci_relation_to_fallback_route_group_test.go @@ -41,10 +41,9 @@ data "aci_relation_to_fallback_route_group" "test" { } ` -const testConfigL3extRsOutToFBRGroupNotExistingL3extOut = testConfigL3extRsOutToFBRGroupMinDependencyWithL3extOut + ` +const testConfigL3extRsOutToFBRGroupNotExistingL3extOut = testConfigL3extOutMinDependencyWithFvTenant + ` data "aci_relation_to_fallback_route_group" "test_non_existing" { parent_dn = aci_l3_outside.test.id target_dn = "uni/tn-test_tenant/ctx-test_vrf/fbrg-fallback_route_group_not_existing" - depends_on = [aci_relation_to_fallback_route_group.test] } ` diff --git a/internal/provider/data_source_aci_relation_to_netflow_exporter_test.go b/internal/provider/data_source_aci_relation_to_netflow_exporter_test.go index c5ef90c08..cbb1f515b 100644 --- a/internal/provider/data_source_aci_relation_to_netflow_exporter_test.go +++ b/internal/provider/data_source_aci_relation_to_netflow_exporter_test.go @@ -41,10 +41,9 @@ data "aci_relation_to_netflow_exporter" "test" { } ` -const testConfigNetflowRsMonitorToExporterNotExistingNetflowMonitorPol = testConfigNetflowRsMonitorToExporterMinDependencyWithNetflowMonitorPol + ` +const testConfigNetflowRsMonitorToExporterNotExistingNetflowMonitorPol = testConfigNetflowMonitorPolMinDependencyWithFvTenant + ` data "aci_relation_to_netflow_exporter" "test_non_existing" { parent_dn = aci_netflow_monitor_policy.test.id netflow_exporter_policy_name = "non_existing_tn_netflow_exporter_pol_name" - depends_on = [aci_relation_to_netflow_exporter.test] } ` diff --git a/internal/provider/data_source_aci_tag_test.go b/internal/provider/data_source_aci_tag_test.go index db0b0865f..dcdbafeef 100644 --- a/internal/provider/data_source_aci_tag_test.go +++ b/internal/provider/data_source_aci_tag_test.go @@ -62,11 +62,10 @@ data "aci_tag" "test" { } ` -const testConfigTagTagNotExistingFvTenant = testConfigTagTagMinDependencyWithFvTenant + ` +const testConfigTagTagNotExistingFvTenant = testConfigFvTenantMin + ` data "aci_tag" "test_non_existing" { parent_dn = aci_tenant.test.id key = "non_existing_key" - depends_on = [aci_tag.test] } ` const testConfigTagTagDataSourceDependencyWithFvAEPg = testConfigTagTagMinDependencyWithFvAEPg + ` @@ -77,10 +76,9 @@ data "aci_tag" "test" { } ` -const testConfigTagTagNotExistingFvAEPg = testConfigTagTagMinDependencyWithFvAEPg + ` +const testConfigTagTagNotExistingFvAEPg = testConfigFvAEPgMin + ` data "aci_tag" "test_non_existing" { parent_dn = aci_application_epg.test.id key = "non_existing_key" - depends_on = [aci_tag.test] } ` diff --git a/internal/provider/data_source_aci_vrf_fallback_route_group_member_test.go b/internal/provider/data_source_aci_vrf_fallback_route_group_member_test.go index a2dfe2eb0..54f9fb60f 100644 --- a/internal/provider/data_source_aci_vrf_fallback_route_group_member_test.go +++ b/internal/provider/data_source_aci_vrf_fallback_route_group_member_test.go @@ -44,10 +44,9 @@ data "aci_vrf_fallback_route_group_member" "test" { } ` -const testConfigFvFBRMemberNotExistingFvFBRGroup = testConfigFvFBRMemberMinDependencyWithFvFBRGroup + ` +const testConfigFvFBRMemberNotExistingFvFBRGroup = testConfigFvFBRGroupMinDependencyWithFvCtx + ` data "aci_vrf_fallback_route_group_member" "test_non_existing" { parent_dn = aci_vrf_fallback_route_group.test.id fallback_member = "2.2.2.4" - depends_on = [aci_vrf_fallback_route_group_member.test] } ` diff --git a/internal/provider/data_source_aci_vrf_fallback_route_group_test.go b/internal/provider/data_source_aci_vrf_fallback_route_group_test.go index c4c12ffe6..c01f15411 100644 --- a/internal/provider/data_source_aci_vrf_fallback_route_group_test.go +++ b/internal/provider/data_source_aci_vrf_fallback_route_group_test.go @@ -43,10 +43,9 @@ data "aci_vrf_fallback_route_group" "test" { } ` -const testConfigFvFBRGroupNotExistingFvCtx = testConfigFvFBRGroupMinDependencyWithFvCtx + ` +const testConfigFvFBRGroupNotExistingFvCtx = testConfigFvCtxMinDependencyWithFvTenant + ` data "aci_vrf_fallback_route_group" "test_non_existing" { parent_dn = aci_vrf.test.id name = "fallback_route_group_non_existing" - depends_on = [aci_vrf_fallback_route_group.test] } ` diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 431a6fb26..d43d729b8 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/provider" "github.com/hashicorp/terraform-plugin-framework/provider/schema" "github.com/hashicorp/terraform-plugin-framework/resource" + // temporary unused until muxing is removed // "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" @@ -196,10 +197,17 @@ func (p *AciProvider) Configure(ctx context.Context, req provider.ConfigureReque func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource { return []func() resource.Resource{ + NewFvCrtrnResource, + NewFvDnsAttrResource, NewFvEpIpTagResource, NewFvEpMacTagResource, NewFvFBRGroupResource, NewFvFBRMemberResource, + NewFvIdGroupAttrResource, + NewFvIpAttrResource, + NewFvMacAttrResource, + NewFvSCrtrnResource, + NewFvVmAttrResource, NewL3extConsLblResource, NewL3extProvLblResource, NewL3extRsOutToFBRGroupResource, @@ -222,10 +230,17 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataSource { return []func() datasource.DataSource{ + NewFvCrtrnDataSource, + NewFvDnsAttrDataSource, NewFvEpIpTagDataSource, NewFvEpMacTagDataSource, NewFvFBRGroupDataSource, NewFvFBRMemberDataSource, + NewFvIdGroupAttrDataSource, + NewFvIpAttrDataSource, + NewFvMacAttrDataSource, + NewFvSCrtrnDataSource, + NewFvVmAttrDataSource, NewL3extConsLblDataSource, NewL3extProvLblDataSource, NewL3extRsOutToFBRGroupDataSource, diff --git a/internal/provider/resource_aci_endpoint_tag_ip.go b/internal/provider/resource_aci_endpoint_tag_ip.go index 2e711138e..f4dbf298c 100644 --- a/internal/provider/resource_aci_endpoint_tag_ip.go +++ b/internal/provider/resource_aci_endpoint_tag_ip.go @@ -85,7 +85,7 @@ func (r *FvEpIpTagResource) Schema(ctx context.Context, req resource.SchemaReque Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag Ip object.", + MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag IP object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -105,7 +105,7 @@ func (r *FvEpIpTagResource) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the Endpoint Tag Ip object.`, + MarkdownDescription: `The annotation of the Endpoint Tag IP object.`, }, "vrf_name": schema.StringAttribute{ Required: true, @@ -113,7 +113,7 @@ func (r *FvEpIpTagResource) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The VRF name of the Endpoint Tag Ip object.`, + MarkdownDescription: `The VRF name of the Endpoint Tag IP object.`, }, "id_attribute": schema.StringAttribute{ Optional: true, @@ -121,7 +121,7 @@ func (r *FvEpIpTagResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The identifier of the Endpoint Tag Ip object.`, + MarkdownDescription: `The identifier of the Endpoint Tag IP object.`, }, "ip": schema.StringAttribute{ Required: true, @@ -129,7 +129,7 @@ func (r *FvEpIpTagResource) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The IP address of the Endpoint Tag Ip object.`, + MarkdownDescription: `The IP address of the Endpoint Tag IP object.`, }, "name": schema.StringAttribute{ Optional: true, @@ -137,7 +137,7 @@ func (r *FvEpIpTagResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name of the Endpoint Tag Ip object.`, + MarkdownDescription: `The name of the Endpoint Tag IP object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -145,7 +145,7 @@ func (r *FvEpIpTagResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the Endpoint Tag Ip object.`, + MarkdownDescription: `The name alias of the Endpoint Tag IP object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, diff --git a/internal/provider/resource_aci_endpoint_tag_mac.go b/internal/provider/resource_aci_endpoint_tag_mac.go index a405e067d..406cb8753 100644 --- a/internal/provider/resource_aci_endpoint_tag_mac.go +++ b/internal/provider/resource_aci_endpoint_tag_mac.go @@ -85,7 +85,7 @@ func (r *FvEpMacTagResource) Schema(ctx context.Context, req resource.SchemaRequ Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag Mac object.", + MarkdownDescription: "The distinguished name (DN) of the Endpoint Tag MAC object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -105,7 +105,7 @@ func (r *FvEpMacTagResource) Schema(ctx context.Context, req resource.SchemaRequ stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the Endpoint Tag Mac object.`, + MarkdownDescription: `The annotation of the Endpoint Tag MAC object.`, }, "bd_name": schema.StringAttribute{ Required: true, @@ -113,7 +113,7 @@ func (r *FvEpMacTagResource) Schema(ctx context.Context, req resource.SchemaRequ stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The bridge domain name of the Endpoint Tag Mac object.`, + MarkdownDescription: `The bridge domain name of the Endpoint Tag MAC object.`, }, "id_attribute": schema.StringAttribute{ Optional: true, @@ -121,7 +121,7 @@ func (r *FvEpMacTagResource) Schema(ctx context.Context, req resource.SchemaRequ PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The identifier of the Endpoint Tag Mac object.`, + MarkdownDescription: `The identifier of the Endpoint Tag MAC object.`, }, "mac": schema.StringAttribute{ Required: true, @@ -129,7 +129,7 @@ func (r *FvEpMacTagResource) Schema(ctx context.Context, req resource.SchemaRequ stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The MAC address of the Endpoint Tag Mac object.`, + MarkdownDescription: `The MAC address of the Endpoint Tag MAC object.`, }, "name": schema.StringAttribute{ Optional: true, @@ -137,7 +137,7 @@ func (r *FvEpMacTagResource) Schema(ctx context.Context, req resource.SchemaRequ PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name of the Endpoint Tag Mac object.`, + MarkdownDescription: `The name of the Endpoint Tag MAC object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -145,7 +145,7 @@ func (r *FvEpMacTagResource) Schema(ctx context.Context, req resource.SchemaRequ PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the Endpoint Tag Mac object.`, + MarkdownDescription: `The name alias of the Endpoint Tag MAC object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, diff --git a/internal/provider/resource_aci_epg_useg_criterion.go b/internal/provider/resource_aci_epg_useg_criterion.go new file mode 100644 index 000000000..faab92827 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion.go @@ -0,0 +1,664 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "encoding/json" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "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/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "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-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvCrtrnResource{} +var _ resource.ResourceWithImportState = &FvCrtrnResource{} + +func NewFvCrtrnResource() resource.Resource { + return &FvCrtrnResource{} +} + +// FvCrtrnResource defines the resource implementation. +type FvCrtrnResource struct { + client *client.Client +} + +// FvCrtrnResourceModel describes the resource data model. +type FvCrtrnResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Match types.String `tfsdk:"match"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + Prec types.String `tfsdk:"precedence"` + Scope types.String `tfsdk:"scope"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvCrtrnResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvCrtrnResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvCrtrnResourceModel describes the resource data model for the children without relation ships. +type TagTagFvCrtrnResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +func (r *FvCrtrnResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion") +} + +func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion resource for the 'fvCrtrn' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the EPG uSeg Criterion object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the EPG uSeg Criterion object.`, + }, + "match": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("all", "any"), + }, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Criterion object.`, + }, + "name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the EPG uSeg Criterion object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the EPG uSeg Criterion object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "precedence": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The precedence of the EPG uSeg Criterion object.`, + }, + "scope": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("scope-bd", "scope-vrf"), + }, + MarkdownDescription: `The scope of the EPG uSeg Criterion object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion") +} + +func (r *FvCrtrnResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion") +} + +func (r *FvCrtrnResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvCrtrnResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvCrtrnId(ctx, stateData) + getAndSetFvCrtrnAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvCrtrnResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvCrtrnId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvCrtrnResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvCrtrnResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvCrtrnCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion") + var data *FvCrtrnResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + + getAndSetFvCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvCrtrnResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvCrtrnResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion") + var data *FvCrtrnResourceModel + var stateData *FvCrtrnResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvCrtrnResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvCrtrnResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvCrtrnCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvCrtrnResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion") + var data *FvCrtrnResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvCrtrn", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvCrtrnResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvCrtrnResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion") +} + +func getAndSetFvCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvCrtrnResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvCrtrn,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvCrtrn").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvCrtrn").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvCrtrnParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "match" { + data.Match = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "prec" { + data.Prec = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "scope" { + data.Scope = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvCrtrnList := make([]TagAnnotationFvCrtrnResourceModel, 0) + TagTagFvCrtrnList := make([]TagTagFvCrtrnResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvCrtrn := TagAnnotationFvCrtrnResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvCrtrn.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvCrtrnList = append(TagAnnotationFvCrtrnList, TagAnnotationFvCrtrn) + } + if childClassName == "tagTag" { + TagTagFvCrtrn := TagTagFvCrtrnResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvCrtrn.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvCrtrnList = append(TagTagFvCrtrnList, TagTagFvCrtrn) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvCrtrnList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvCrtrnList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvCrtrn'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvCrtrnRn(ctx context.Context, data *FvCrtrnResourceModel) string { + return "crtrn" +} + +func setFvCrtrnParentDn(ctx context.Context, dn string, data *FvCrtrnResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvCrtrnId(ctx context.Context, data *FvCrtrnResourceModel) { + rn := getFvCrtrnRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvCrtrnTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvCrtrnResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvCrtrnResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvCrtrnTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvCrtrnResourceModel, tagTagPlan, tagTagState []TagTagFvCrtrnResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvCrtrnCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvCrtrnResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvCrtrnResourceModel, tagTagPlan, tagTagState []TagTagFvCrtrnResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvCrtrnTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvCrtrnTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Match.IsNull() && !data.Match.IsUnknown() { + payloadMap["attributes"].(map[string]string)["match"] = data.Match.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.Prec.IsNull() && !data.Prec.IsUnknown() { + payloadMap["attributes"].(map[string]string)["prec"] = data.Prec.ValueString() + } + if !data.Scope.IsNull() && !data.Scope.IsUnknown() { + payloadMap["attributes"].(map[string]string)["scope"] = data.Scope.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvCrtrn": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_epg_useg_criterion_dns_attribute.go b/internal/provider/resource_aci_epg_useg_criterion_dns_attribute.go new file mode 100644 index 000000000..0e6ec59e6 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_dns_attribute.go @@ -0,0 +1,638 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/diag" + "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/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvDnsAttrResource{} +var _ resource.ResourceWithImportState = &FvDnsAttrResource{} + +func NewFvDnsAttrResource() resource.Resource { + return &FvDnsAttrResource{} +} + +// FvDnsAttrResource defines the resource implementation. +type FvDnsAttrResource struct { + client *client.Client +} + +// FvDnsAttrResourceModel describes the resource data model. +type FvDnsAttrResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Filter types.String `tfsdk:"filter"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvDnsAttrResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvDnsAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvDnsAttrResourceModel describes the resource data model for the children without relation ships. +type TagTagFvDnsAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvDnsAttrIdentifier struct { + Name types.String +} + +func (r *FvDnsAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_dns_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_dns_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_dns_attribute") +} + +func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_dns_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_dns_attribute resource for the 'fvDnsAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the EPG uSeg Criterion DNS Attribute object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the EPG uSeg Criterion DNS Attribute object.`, + }, + "filter": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The domain name filter of the EPG uSeg Criterion DNS Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the EPG uSeg Criterion DNS Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the EPG uSeg Criterion DNS Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_dns_attribute") +} + +func (r *FvDnsAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_dns_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_dns_attribute") +} + +func (r *FvDnsAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_dns_attribute") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvDnsAttrResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvDnsAttrId(ctx, stateData) + getAndSetFvDnsAttrAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvDnsAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvDnsAttrId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvDnsAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvDnsAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvDnsAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvDnsAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvDnsAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_dns_attribute") + var data *FvDnsAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvDnsAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvDnsAttrResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvDnsAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_dns_attribute") + var data *FvDnsAttrResourceModel + var stateData *FvDnsAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvDnsAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvDnsAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvDnsAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvDnsAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvDnsAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_dns_attribute") + var data *FvDnsAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvDnsAttr", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvDnsAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_dns_attribute") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvDnsAttrResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_dns_attribute with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_dns_attribute") +} + +func getAndSetFvDnsAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvDnsAttrResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvDnsAttr,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvDnsAttr").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvDnsAttr").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvDnsAttrParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "filter" { + data.Filter = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvDnsAttrList := make([]TagAnnotationFvDnsAttrResourceModel, 0) + TagTagFvDnsAttrList := make([]TagTagFvDnsAttrResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvDnsAttr := TagAnnotationFvDnsAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvDnsAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvDnsAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvDnsAttrList = append(TagAnnotationFvDnsAttrList, TagAnnotationFvDnsAttr) + } + if childClassName == "tagTag" { + TagTagFvDnsAttr := TagTagFvDnsAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvDnsAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvDnsAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvDnsAttrList = append(TagTagFvDnsAttrList, TagTagFvDnsAttr) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvDnsAttrList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvDnsAttrList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvDnsAttr'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvDnsAttrRn(ctx context.Context, data *FvDnsAttrResourceModel) string { + rn := "dnsattr-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvDnsAttrParentDn(ctx context.Context, dn string, data *FvDnsAttrResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvDnsAttrId(ctx context.Context, data *FvDnsAttrResourceModel) { + rn := getFvDnsAttrRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvDnsAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvDnsAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvDnsAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvDnsAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvDnsAttrResourceModel, tagTagPlan, tagTagState []TagTagFvDnsAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvDnsAttrCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvDnsAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvDnsAttrResourceModel, tagTagPlan, tagTagState []TagTagFvDnsAttrResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvDnsAttrTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvDnsAttrTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Filter.IsNull() && !data.Filter.IsUnknown() { + payloadMap["attributes"].(map[string]string)["filter"] = data.Filter.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvDnsAttr": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_epg_useg_criterion_dns_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_dns_attribute_test.go new file mode 100644 index 000000000..63c1d5ce6 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_dns_attribute_test.go @@ -0,0 +1,264 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvDnsAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvDnsAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", "filter"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", "owner_tag"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvDnsAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvDnsAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_criterion_dns_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvDnsAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_criterion_dns_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvDnsAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvDnsAttrChildrenRemoveOneDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvDnsAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvDnsAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" +} +` + +const testConfigFvDnsAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" + annotation = "annotation" + description = "description" + filter = "filter" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigFvDnsAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" + annotation = "orchestrator:terraform" + description = "" + filter = "" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvDnsAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvDnsAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" +} +` + +const testConfigFvDnsAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvDnsAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_dns_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "dns_attribute" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute.go b/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute.go new file mode 100644 index 000000000..0bcfee622 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute.go @@ -0,0 +1,638 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/diag" + "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/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvIdGroupAttrResource{} +var _ resource.ResourceWithImportState = &FvIdGroupAttrResource{} + +func NewFvIdGroupAttrResource() resource.Resource { + return &FvIdGroupAttrResource{} +} + +// FvIdGroupAttrResource defines the resource implementation. +type FvIdGroupAttrResource struct { + client *client.Client +} + +// FvIdGroupAttrResourceModel describes the resource data model. +type FvIdGroupAttrResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + Selector types.String `tfsdk:"selector"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvIdGroupAttrResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvIdGroupAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvIdGroupAttrResourceModel describes the resource data model for the children without relation ships. +type TagTagFvIdGroupAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvIdGroupAttrIdentifier struct { + Selector types.String +} + +func (r *FvIdGroupAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_identity_group_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_identity_group_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_identity_group_attribute") +} + +func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_identity_group_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_identity_group_attribute resource for the 'fvIdGroupAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the EPG uSeg Criterion Identity Group Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "selector": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_identity_group_attribute") +} + +func (r *FvIdGroupAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_identity_group_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_identity_group_attribute") +} + +func (r *FvIdGroupAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_identity_group_attribute") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvIdGroupAttrResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvIdGroupAttrId(ctx, stateData) + getAndSetFvIdGroupAttrAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvIdGroupAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvIdGroupAttrId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIdGroupAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvIdGroupAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvIdGroupAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvIdGroupAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIdGroupAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_identity_group_attribute") + var data *FvIdGroupAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvIdGroupAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvIdGroupAttrResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIdGroupAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_identity_group_attribute") + var data *FvIdGroupAttrResourceModel + var stateData *FvIdGroupAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIdGroupAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvIdGroupAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvIdGroupAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvIdGroupAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIdGroupAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_identity_group_attribute") + var data *FvIdGroupAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvIdGroupAttr", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIdGroupAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_identity_group_attribute") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvIdGroupAttrResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_identity_group_attribute") +} + +func getAndSetFvIdGroupAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvIdGroupAttrResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvIdGroupAttr,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvIdGroupAttr").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvIdGroupAttr").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvIdGroupAttrParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "selector" { + data.Selector = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvIdGroupAttrList := make([]TagAnnotationFvIdGroupAttrResourceModel, 0) + TagTagFvIdGroupAttrList := make([]TagTagFvIdGroupAttrResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvIdGroupAttr := TagAnnotationFvIdGroupAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvIdGroupAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvIdGroupAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvIdGroupAttrList = append(TagAnnotationFvIdGroupAttrList, TagAnnotationFvIdGroupAttr) + } + if childClassName == "tagTag" { + TagTagFvIdGroupAttr := TagTagFvIdGroupAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvIdGroupAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvIdGroupAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvIdGroupAttrList = append(TagTagFvIdGroupAttrList, TagTagFvIdGroupAttr) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvIdGroupAttrList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvIdGroupAttrList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvIdGroupAttr'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvIdGroupAttrRn(ctx context.Context, data *FvIdGroupAttrResourceModel) string { + rn := "idgattr-[{selector}]" + for _, identifier := range []string{"selector"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvIdGroupAttrParentDn(ctx context.Context, dn string, data *FvIdGroupAttrResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvIdGroupAttrId(ctx context.Context, data *FvIdGroupAttrResourceModel) { + rn := getFvIdGroupAttrRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvIdGroupAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvIdGroupAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIdGroupAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvIdGroupAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvIdGroupAttrResourceModel, tagTagPlan, tagTagState []TagTagFvIdGroupAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvIdGroupAttrCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvIdGroupAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIdGroupAttrResourceModel, tagTagPlan, tagTagState []TagTagFvIdGroupAttrResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvIdGroupAttrTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvIdGroupAttrTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.Selector.IsNull() && !data.Selector.IsUnknown() { + payloadMap["attributes"].(map[string]string)["selector"] = data.Selector.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvIdGroupAttr": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute_test.go new file mode 100644 index 000000000..a0b5f37a5 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute_test.go @@ -0,0 +1,264 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvIdGroupAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", "name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", "owner_tag"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvIdGroupAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_criterion_identity_group_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvIdGroupAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_criterion_identity_group_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvIdGroupAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvIdGroupAttrChildrenRemoveOneDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvIdGroupAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvIdGroupAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} +` + +const testConfigFvIdGroupAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + annotation = "annotation" + description = "description" + name = "name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigFvIdGroupAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + annotation = "orchestrator:terraform" + description = "" + name = "" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvIdGroupAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIdGroupAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} +` + +const testConfigFvIdGroupAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIdGroupAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_identity_group_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_ip_attribute.go b/internal/provider/resource_aci_epg_useg_criterion_ip_attribute.go new file mode 100644 index 000000000..48012f3e2 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_ip_attribute.go @@ -0,0 +1,657 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "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/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "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-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvIpAttrResource{} +var _ resource.ResourceWithImportState = &FvIpAttrResource{} + +func NewFvIpAttrResource() resource.Resource { + return &FvIpAttrResource{} +} + +// FvIpAttrResource defines the resource implementation. +type FvIpAttrResource struct { + client *client.Client +} + +// FvIpAttrResourceModel describes the resource data model. +type FvIpAttrResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Ip types.String `tfsdk:"ip"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + UsefvSubnet types.String `tfsdk:"use_fv_subnet"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvIpAttrResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvIpAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvIpAttrResourceModel describes the resource data model for the children without relation ships. +type TagTagFvIpAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvIpAttrIdentifier struct { + Name types.String +} + +func (r *FvIpAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_ip_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_ip_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_ip_attribute") +} + +func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_ip_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_ip_attribute resource for the 'fvIpAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the EPG uSeg Criterion IP Attribute object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the EPG uSeg Criterion IP Attribute object.`, + }, + "ip": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The device IP address of the EPG uSeg Criterion IP Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the EPG uSeg Criterion IP Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the EPG uSeg Criterion IP Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "use_fv_subnet": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_ip_attribute") +} + +func (r *FvIpAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_ip_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_ip_attribute") +} + +func (r *FvIpAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_ip_attribute") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvIpAttrResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvIpAttrId(ctx, stateData) + getAndSetFvIpAttrAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvIpAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvIpAttrId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIpAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvIpAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvIpAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvIpAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIpAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_ip_attribute") + var data *FvIpAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvIpAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvIpAttrResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIpAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_ip_attribute") + var data *FvIpAttrResourceModel + var stateData *FvIpAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIpAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvIpAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvIpAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvIpAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIpAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_ip_attribute") + var data *FvIpAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvIpAttr", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvIpAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_ip_attribute") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvIpAttrResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_ip_attribute with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_ip_attribute") +} + +func getAndSetFvIpAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvIpAttrResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvIpAttr,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvIpAttr").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvIpAttr").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvIpAttrParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ip" { + data.Ip = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "usefvSubnet" { + data.UsefvSubnet = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvIpAttrList := make([]TagAnnotationFvIpAttrResourceModel, 0) + TagTagFvIpAttrList := make([]TagTagFvIpAttrResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvIpAttr := TagAnnotationFvIpAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvIpAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvIpAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvIpAttrList = append(TagAnnotationFvIpAttrList, TagAnnotationFvIpAttr) + } + if childClassName == "tagTag" { + TagTagFvIpAttr := TagTagFvIpAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvIpAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvIpAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvIpAttrList = append(TagTagFvIpAttrList, TagTagFvIpAttr) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvIpAttrList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvIpAttrList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvIpAttr'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvIpAttrRn(ctx context.Context, data *FvIpAttrResourceModel) string { + rn := "ipattr-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvIpAttrParentDn(ctx context.Context, dn string, data *FvIpAttrResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvIpAttrId(ctx context.Context, data *FvIpAttrResourceModel) { + rn := getFvIpAttrRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvIpAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvIpAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIpAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvIpAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvIpAttrResourceModel, tagTagPlan, tagTagState []TagTagFvIpAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvIpAttrCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvIpAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIpAttrResourceModel, tagTagPlan, tagTagState []TagTagFvIpAttrResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvIpAttrTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvIpAttrTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Ip.IsNull() && !data.Ip.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ip"] = data.Ip.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.UsefvSubnet.IsNull() && !data.UsefvSubnet.IsUnknown() { + payloadMap["attributes"].(map[string]string)["usefvSubnet"] = data.UsefvSubnet.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvIpAttr": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_epg_useg_criterion_ip_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_ip_attribute_test.go new file mode 100644 index 000000000..7767ebba7 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_ip_attribute_test.go @@ -0,0 +1,278 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvIpAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvIpAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "0.0.0.0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "yes"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvIpAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvIpAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_criterion_ip_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + // Update with children + { + Config: testConfigFvIpAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_criterion_ip_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvIpAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvIpAttrChildrenRemoveOneDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvIpAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvIpAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + ip = "131.107.1.200" + name = "131" +} +` + +const testConfigFvIpAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "131" + annotation = "annotation" + description = "description" + ip = "0.0.0.0" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + use_fv_subnet = "yes" +} +` + +const testConfigFvIpAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "131" + annotation = "orchestrator:terraform" + description = "" + ip = "131.107.1.200" + name_alias = "" + owner_key = "" + owner_tag = "" + use_fv_subnet = "no" +} +` +const testConfigFvIpAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + ip = "131.107.1.200" + name = "131" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIpAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + ip = "131.107.1.200" + name = "131" +} +` + +const testConfigFvIpAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + ip = "131.107.1.200" + name = "131" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIpAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_ip_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + ip = "131.107.1.200" + name = "131" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_mac_attribute.go b/internal/provider/resource_aci_epg_useg_criterion_mac_attribute.go new file mode 100644 index 000000000..c0568797b --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_mac_attribute.go @@ -0,0 +1,637 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/diag" + "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/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvMacAttrResource{} +var _ resource.ResourceWithImportState = &FvMacAttrResource{} + +func NewFvMacAttrResource() resource.Resource { + return &FvMacAttrResource{} +} + +// FvMacAttrResource defines the resource implementation. +type FvMacAttrResource struct { + client *client.Client +} + +// FvMacAttrResourceModel describes the resource data model. +type FvMacAttrResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Mac types.String `tfsdk:"mac"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvMacAttrResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvMacAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvMacAttrResourceModel describes the resource data model for the children without relation ships. +type TagTagFvMacAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvMacAttrIdentifier struct { + Name types.String +} + +func (r *FvMacAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_mac_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_mac_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_mac_attribute") +} + +func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_mac_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_mac_attribute resource for the 'fvMacAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the EPG uSeg Criterion MAC Attribute object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the EPG uSeg Criterion MAC Attribute object.`, + }, + "mac": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The MAC address of the EPG uSeg Criterion MAC Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the EPG uSeg Criterion MAC Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the EPG uSeg Criterion MAC Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_mac_attribute") +} + +func (r *FvMacAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_mac_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_mac_attribute") +} + +func (r *FvMacAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_mac_attribute") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvMacAttrResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvMacAttrId(ctx, stateData) + getAndSetFvMacAttrAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvMacAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvMacAttrId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvMacAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvMacAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvMacAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvMacAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvMacAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_mac_attribute") + var data *FvMacAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvMacAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvMacAttrResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvMacAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_mac_attribute") + var data *FvMacAttrResourceModel + var stateData *FvMacAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvMacAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvMacAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvMacAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvMacAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvMacAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_mac_attribute") + var data *FvMacAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvMacAttr", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvMacAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_mac_attribute") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvMacAttrResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_mac_attribute with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_mac_attribute") +} + +func getAndSetFvMacAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvMacAttrResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvMacAttr,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvMacAttr").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvMacAttr").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvMacAttrParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mac" { + data.Mac = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvMacAttrList := make([]TagAnnotationFvMacAttrResourceModel, 0) + TagTagFvMacAttrList := make([]TagTagFvMacAttrResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvMacAttr := TagAnnotationFvMacAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvMacAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvMacAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvMacAttrList = append(TagAnnotationFvMacAttrList, TagAnnotationFvMacAttr) + } + if childClassName == "tagTag" { + TagTagFvMacAttr := TagTagFvMacAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvMacAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvMacAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvMacAttrList = append(TagTagFvMacAttrList, TagTagFvMacAttr) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvMacAttrList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvMacAttrList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvMacAttr'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvMacAttrRn(ctx context.Context, data *FvMacAttrResourceModel) string { + rn := "macattr-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvMacAttrParentDn(ctx context.Context, dn string, data *FvMacAttrResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvMacAttrId(ctx context.Context, data *FvMacAttrResourceModel) { + rn := getFvMacAttrRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvMacAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvMacAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvMacAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvMacAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvMacAttrResourceModel, tagTagPlan, tagTagState []TagTagFvMacAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvMacAttrCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvMacAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvMacAttrResourceModel, tagTagPlan, tagTagState []TagTagFvMacAttrResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvMacAttrTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvMacAttrTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Mac.IsNull() && !data.Mac.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mac"] = data.Mac.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvMacAttr": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_epg_useg_criterion_mac_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_mac_attribute_test.go new file mode 100644 index 000000000..b4be658ed --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_mac_attribute_test.go @@ -0,0 +1,270 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvMacAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvMacAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:BB:BB:EE"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", "owner_tag"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvMacAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvMacAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_criterion_mac_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvMacAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_criterion_mac_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvMacAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvMacAttrChildrenRemoveOneDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvMacAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvMacAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" +} +` + +const testConfigFvMacAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "mac_attr" + annotation = "annotation" + description = "description" + mac = "AA:BB:CC:BB:BB:EE" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigFvMacAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "mac_attr" + annotation = "orchestrator:terraform" + description = "" + mac = "AA:BB:CC:DD:EE:FF" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvMacAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvMacAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" +} +` + +const testConfigFvMacAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvMacAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_mac_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_test.go b/internal/provider/resource_aci_epg_useg_criterion_test.go new file mode 100644 index 000000000..75d7db374 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_test.go @@ -0,0 +1,273 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvCrtrnMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvCrtrnAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "all"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", "criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvCrtrnMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc(), + }, + // Update with empty strings config or default value + { + Config: testConfigFvCrtrnResetDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_criterion.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), + ), + }, + // Update with children + { + Config: testConfigFvCrtrnChildrenDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_criterion.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvCrtrnChildrenRemoveFromConfigDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvCrtrnChildrenRemoveOneDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvCrtrnChildrenRemoveAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvCrtrnMinDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id +} +` + +const testConfigFvCrtrnAllDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id + annotation = "annotation" + description = "description" + match = "all" + name = "criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + precedence = "1" + scope = "scope-bd" +} +` + +const testConfigFvCrtrnResetDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id + annotation = "orchestrator:terraform" + description = "" + match = "any" + name = "" + name_alias = "" + owner_key = "" + owner_tag = "" + precedence = "0" + scope = "scope-bd" +} +` +const testConfigFvCrtrnChildrenDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvCrtrnChildrenRemoveFromConfigDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id +} +` + +const testConfigFvCrtrnChildrenRemoveOneDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvCrtrnChildrenRemoveAllDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_vm_attribute.go b/internal/provider/resource_aci_epg_useg_criterion_vm_attribute.go new file mode 100644 index 000000000..c2ad1951b --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_vm_attribute.go @@ -0,0 +1,705 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "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/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "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-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvVmAttrResource{} +var _ resource.ResourceWithImportState = &FvVmAttrResource{} + +func NewFvVmAttrResource() resource.Resource { + return &FvVmAttrResource{} +} + +// FvVmAttrResource defines the resource implementation. +type FvVmAttrResource struct { + client *client.Client +} + +// FvVmAttrResourceModel describes the resource data model. +type FvVmAttrResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Category types.String `tfsdk:"category"` + Descr types.String `tfsdk:"description"` + LabelName types.String `tfsdk:"label_name"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + Operator types.String `tfsdk:"operator"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + Type types.String `tfsdk:"type"` + Value types.String `tfsdk:"value"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvVmAttrResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvVmAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvVmAttrResourceModel describes the resource data model for the children without relation ships. +type TagTagFvVmAttrResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvVmAttrIdentifier struct { + Name types.String +} + +func (r *FvVmAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_vm_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_vm_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_vm_attribute") +} + +func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_vm_attribute") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_criterion_vm_attribute resource for the 'fvVmAttr' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the EPG uSeg Criterion VM Attribute object.`, + }, + "category": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The category of the EPG uSeg Criterion VM Attribute object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the EPG uSeg Criterion VM Attribute object.`, + }, + "label_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The label name of the EPG uSeg Criterion VM Attribute object.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the EPG uSeg Criterion VM Attribute object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the EPG uSeg Criterion VM Attribute object.`, + }, + "operator": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("contains", "endsWith", "equals", "notEquals", "startsWith"), + }, + MarkdownDescription: `The operator of the EPG uSeg Criterion VM Attribute object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "type": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("custom-label", "domain", "guest-os", "hv", "rootContName", "tag", "vm", "vm-folder", "vm-name", "vmfolder-path", "vnic"), + }, + MarkdownDescription: `The type of the EPG uSeg Criterion VM Attribute object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the EPG uSeg Criterion VM Attribute object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_vm_attribute") +} + +func (r *FvVmAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_vm_attribute") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_vm_attribute") +} + +func (r *FvVmAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_vm_attribute") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvVmAttrResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvVmAttrId(ctx, stateData) + getAndSetFvVmAttrAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvVmAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvVmAttrId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvVmAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvVmAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvVmAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvVmAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvVmAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_vm_attribute") + var data *FvVmAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + + getAndSetFvVmAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvVmAttrResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvVmAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_vm_attribute") + var data *FvVmAttrResourceModel + var stateData *FvVmAttrResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvVmAttrResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvVmAttrResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvVmAttrCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvVmAttrAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvVmAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_vm_attribute") + var data *FvVmAttrResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvVmAttr", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) +} + +func (r *FvVmAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_vm_attribute") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvVmAttrResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_vm_attribute with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_vm_attribute") +} + +func getAndSetFvVmAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvVmAttrResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvVmAttr,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvVmAttr").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvVmAttr").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvVmAttrParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "category" { + data.Category = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "labelName" { + data.LabelName = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "operator" { + data.Operator = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "type" { + data.Type = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "value" { + data.Value = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvVmAttrList := make([]TagAnnotationFvVmAttrResourceModel, 0) + TagTagFvVmAttrList := make([]TagTagFvVmAttrResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvVmAttr := TagAnnotationFvVmAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvVmAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvVmAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvVmAttrList = append(TagAnnotationFvVmAttrList, TagAnnotationFvVmAttr) + } + if childClassName == "tagTag" { + TagTagFvVmAttr := TagTagFvVmAttrResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvVmAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvVmAttr.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvVmAttrList = append(TagTagFvVmAttrList, TagTagFvVmAttr) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvVmAttrList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvVmAttrList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvVmAttr'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvVmAttrRn(ctx context.Context, data *FvVmAttrResourceModel) string { + rn := "vmattr-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvVmAttrParentDn(ctx context.Context, dn string, data *FvVmAttrResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvVmAttrId(ctx context.Context, data *FvVmAttrResourceModel) { + rn := getFvVmAttrRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvVmAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvVmAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvVmAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvVmAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvVmAttrResourceModel, tagTagPlan, tagTagState []TagTagFvVmAttrResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvVmAttrCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvVmAttrResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvVmAttrResourceModel, tagTagPlan, tagTagState []TagTagFvVmAttrResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvVmAttrTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvVmAttrTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Category.IsNull() && !data.Category.IsUnknown() { + payloadMap["attributes"].(map[string]string)["category"] = data.Category.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.LabelName.IsNull() && !data.LabelName.IsUnknown() { + payloadMap["attributes"].(map[string]string)["labelName"] = data.LabelName.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.Operator.IsNull() && !data.Operator.IsUnknown() { + payloadMap["attributes"].(map[string]string)["operator"] = data.Operator.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.Type.IsNull() && !data.Type.IsUnknown() { + payloadMap["attributes"].(map[string]string)["type"] = data.Type.ValueString() + } + if !data.Value.IsNull() && !data.Value.IsUnknown() { + payloadMap["attributes"].(map[string]string)["value"] = data.Value.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvVmAttr": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_epg_useg_criterion_vm_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_vm_attribute_test.go new file mode 100644 index 000000000..78c36f63c --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_criterion_vm_attribute_test.go @@ -0,0 +1,592 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvVmAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvVmAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", "all_category"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", "label_name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "contains"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "domain"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "all_value"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvVmAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvVmAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_criterion_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + ), + }, + // Update with children + { + Config: testConfigFvVmAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_criterion_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvVmAttrChildrenRemoveOneDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvVmAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} +func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvVmAttrMinDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvVmAttrAllDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", "all_category"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", "label_name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "contains"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "domain"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "all_value"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvVmAttrMinDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvVmAttrResetDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_criterion_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + ), + }, + // Update with children + { + Config: testConfigFvVmAttrChildrenDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_criterion_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvVmAttrChildrenRemoveOneDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvVmAttrChildrenRemoveAllDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvVmAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "all_value" +} +` + +const testConfigFvVmAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + annotation = "orchestrator:terraform" + category = "" + description = "" + label_name = "" + name_alias = "" + operator = "equals" + owner_key = "" + owner_tag = "" + type = "vm-name" + value = "default_value" +} +` +const testConfigFvVmAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "vm_attribute" + value = "default_value" + annotations = [] + tags = [] +} +` + +const testConfigFvVmAttrMinDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "all_value" +} +` + +const testConfigFvVmAttrResetDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + annotation = "orchestrator:terraform" + category = "" + description = "" + label_name = "" + name_alias = "" + operator = "equals" + owner_key = "" + owner_tag = "" + type = "vm-name" + value = "default_value" +} +` +const testConfigFvVmAttrChildrenDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrChildrenRemoveOneDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` +resource "aci_epg_useg_criterion_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_criterion.test.id + name = "vm_attribute" + value = "default_value" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_sub_criterion.go b/internal/provider/resource_aci_epg_useg_sub_criterion.go new file mode 100644 index 000000000..57d228137 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_sub_criterion.go @@ -0,0 +1,643 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "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/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "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-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvSCrtrnResource{} +var _ resource.ResourceWithImportState = &FvSCrtrnResource{} + +func NewFvSCrtrnResource() resource.Resource { + return &FvSCrtrnResource{} +} + +// FvSCrtrnResource defines the resource implementation. +type FvSCrtrnResource struct { + client *client.Client +} + +// FvSCrtrnResourceModel describes the resource data model. +type FvSCrtrnResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Match types.String `tfsdk:"match"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvSCrtrnResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvSCrtrnResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvSCrtrnResourceModel describes the resource data model for the children without relation ships. +type TagTagFvSCrtrnResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvSCrtrnIdentifier struct { + Name types.String +} + +func (r *FvSCrtrnResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_sub_criterion") + resp.TypeName = req.ProviderTypeName + "_epg_useg_sub_criterion" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_sub_criterion") +} + +func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_sub_criterion") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The epg_useg_sub_criterion resource for the 'fvSCrtrn' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Sub Criterion object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the EPG uSeg Sub Criterion object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the EPG uSeg Sub Criterion object.`, + }, + "match": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("all", "any"), + }, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Sub Criterion object.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the EPG uSeg Sub Criterion object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the EPG uSeg Sub Criterion object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_sub_criterion") +} + +func (r *FvSCrtrnResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_sub_criterion") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_sub_criterion") +} + +func (r *FvSCrtrnResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_sub_criterion") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvSCrtrnResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvSCrtrnId(ctx, stateData) + getAndSetFvSCrtrnAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvSCrtrnResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvSCrtrnId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvSCrtrnResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvSCrtrnResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvSCrtrnCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvSCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvSCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_sub_criterion") + var data *FvSCrtrnResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + + getAndSetFvSCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvSCrtrnResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvSCrtrnResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_sub_criterion") + var data *FvSCrtrnResourceModel + var stateData *FvSCrtrnResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvSCrtrnResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvSCrtrnResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvSCrtrnCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvSCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvSCrtrnResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_sub_criterion") + var data *FvSCrtrnResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvSCrtrn", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) +} + +func (r *FvSCrtrnResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_sub_criterion") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvSCrtrnResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_sub_criterion with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_sub_criterion") +} + +func getAndSetFvSCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvSCrtrnResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvSCrtrn,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvSCrtrn").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvSCrtrn").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvSCrtrnParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "match" { + data.Match = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvSCrtrnList := make([]TagAnnotationFvSCrtrnResourceModel, 0) + TagTagFvSCrtrnList := make([]TagTagFvSCrtrnResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvSCrtrn := TagAnnotationFvSCrtrnResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvSCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvSCrtrn.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvSCrtrnList = append(TagAnnotationFvSCrtrnList, TagAnnotationFvSCrtrn) + } + if childClassName == "tagTag" { + TagTagFvSCrtrn := TagTagFvSCrtrnResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvSCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvSCrtrn.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvSCrtrnList = append(TagTagFvSCrtrnList, TagTagFvSCrtrn) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvSCrtrnList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvSCrtrnList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvSCrtrn'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvSCrtrnRn(ctx context.Context, data *FvSCrtrnResourceModel) string { + rn := "crtrn-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvSCrtrnParentDn(ctx context.Context, dn string, data *FvSCrtrnResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvSCrtrnId(ctx context.Context, data *FvSCrtrnResourceModel) { + rn := getFvSCrtrnRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvSCrtrnTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvSCrtrnResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvSCrtrnResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvSCrtrnTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvSCrtrnResourceModel, tagTagPlan, tagTagState []TagTagFvSCrtrnResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvSCrtrnCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvSCrtrnResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvSCrtrnResourceModel, tagTagPlan, tagTagState []TagTagFvSCrtrnResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvSCrtrnTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvSCrtrnTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Match.IsNull() && !data.Match.IsUnknown() { + payloadMap["attributes"].(map[string]string)["match"] = data.Match.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvSCrtrn": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_epg_useg_sub_criterion_test.go b/internal/provider/resource_aci_epg_useg_sub_criterion_test.go new file mode 100644 index 000000000..4517a8825 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_sub_criterion_test.go @@ -0,0 +1,264 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvSCrtrnMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvSCrtrnAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "all"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", "owner_tag"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvSCrtrnMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvSCrtrnResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_sub_criterion.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvSCrtrnChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_sub_criterion.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvSCrtrnMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" +} +` + +const testConfigFvSCrtrnAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" + annotation = "annotation" + description = "description" + match = "all" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigFvSCrtrnResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" + annotation = "orchestrator:terraform" + description = "" + match = "any" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvSCrtrnChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" +} +` + +const testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "sub_criterion" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/test_constants.go b/internal/provider/test_constants.go index e44ac5da0..353c7b182 100644 --- a/internal/provider/test_constants.go +++ b/internal/provider/test_constants.go @@ -88,3 +88,16 @@ resource "aci_l3out_loopback_interface_profile" "test" { addr = "1.2.3.5" } ` + +const testConfigFvCrtrnMin = testConfigFvAEPgMin + ` +resource "aci_epg_useg_criterion" "test" { + parent_dn = aci_application_epg.test.id +} +` + +const testConfigFvSCrtrnMin = testConfigFvCrtrnMin + ` +resource "aci_epg_useg_sub_criterion" "test" { + parent_dn = aci_epg_useg_criterion.test.id + name = "test_name" +} +` diff --git a/main.go b/main.go index 6240b8d15..4363a8d1e 100644 --- a/main.go +++ b/main.go @@ -19,6 +19,9 @@ import ( // Run the resource and datasource generation tool. //go:generate go run gen/generator.go +// Format code and cleanup imports +//go:generate go run -mod=mod golang.org/x/tools/cmd/goimports -w internal/provider/ + // If you do not have terraform installed, you can remove the formatting command, but its suggested to // ensure the documentation is formatted properly. //go:generate terraform fmt -recursive ./examples/