diff --git a/docs/data-sources/annotation.md b/docs/data-sources/annotation.md index 16bf50ce8..6b4abdee0 100644 --- a/docs/data-sources/annotation.md +++ b/docs/data-sources/annotation.md @@ -53,6 +53,10 @@ data "aci_annotation" "example_application_epg" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_http_ssl_configuration](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/http_ssl_configuration) ([commHttps](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commHttps/overview)) + - [aci_communication_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/communication_policy) ([commPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commPol/overview)) + - [aci_tp](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tp) ([commRsClientCertCA](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commRsClientCertCA/overview)) + - [aci_key_ring](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/key_ring) ([commRsKeyRing](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commRsKeyRing/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_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)) diff --git a/docs/data-sources/communication_policy.md b/docs/data-sources/communication_policy.md new file mode 100644 index 000000000..6f8647135 --- /dev/null +++ b/docs/data-sources/communication_policy.md @@ -0,0 +1,81 @@ +--- +# 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: "Generic" +layout: "aci" +page_title: "ACI: aci_communication_policy" +sidebar_current: "docs-aci-data-source-aci_communication_policy" +description: |- + Data source for Communication Policy +--- + +# aci_communication_policy # + +Data source for Communication Policy + +## API Information ## + +* Class: [commPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commPol/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/fabric/comm-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +```hcl + +data "aci_communication_policy" "example" { + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `name` (name) - (string) The name of the Communication Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Communication Policy object. +* `annotation` (annotation) - (string) The annotation of the Communication Policy object. +* `description` (descr) - (string) The description of the Communication Policy object. +* `name_alias` (nameAlias) - (string) The name alias of the Communication Policy 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. +* `strict_security_on_apic_oob_subnet` (strictSecurityOnApicOOBSubnet) - (string) remove implicit access on apic oob from any apic OOB subnet IP. + +* `http_ssl_configuration` - (list) A list of Http Ssl Configuration objects ([commHttps](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commHttps/overview)). + * `access_control_allow_credential` (accessControlAllowCredential) - (string) accessControlAllowCredential. + * `access_control_allow_origins` (accessControlAllowOrigins) - (string) + * `admin_st` (adminSt) - (string) The state of HTTPS communication service. This can be enabled or disabled. + * `annotation` (annotation) - (string) The annotation of the Http Ssl Configuration object. + * `cli_only_mode` (cliOnlyMode) - (string) CLI only mode. + * `client_cert_auth_state` (clientCertAuthState) - (string) Client Cert Auth State. + * `description` (descr) - (string) The description of the Http Ssl Configuration object. + * `dh_param` (dhParam) - (string) DH Parameter. + * `global_throttle_rate` (globalThrottleRate) - (string) The maximum MO api calls allowed per unit time. + * `global_throttle_st` (globalThrottleSt) - (string) Throttle state for all clients without tag0 in header. + * `global_throttle_unit` (globalThrottleUnit) - (string) Unit of rate limit. + * `max_request_status_count` (maxRequestStatusCount) - (string) The maximum number of request status objects to keep. + * `name` (name) - (string) The name of the Http Ssl Configuration object. + * `name_alias` (nameAlias) - (string) The name alias of the Http Ssl Configuration object. + * `node_exporter` (nodeExporter) - (string) Node Exporter service. + * `port` (port) - (string) The port used for HTTPS communication service. + * `referer` (referer) - (string) Allowed HTTP referer space separated list. + * `server_header` (serverHeader) - (string) Server Header. + * `ssl_protocols` (sslProtocols) - (list) The Secure Socket Layer (SSL) protocol. + * `throttle_rate` (throttleRate) - (string) The maximum login/refresh allowed per second. + * `throttle_st` (throttleSt) - (string) Login/refresh throttle state. + * `visore_access` (visoreAccess) - (string) Visore Access. + +* `annotations` - (list) A list of Annotations objects ([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. diff --git a/docs/resources/annotation.md b/docs/resources/annotation.md index 8681160d1..4e9f08778 100644 --- a/docs/resources/annotation.md +++ b/docs/resources/annotation.md @@ -62,6 +62,10 @@ All examples for the Annotation resource can be found in the [examples](https:// ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_http_ssl_configuration](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/http_ssl_configuration) ([commHttps](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commHttps/overview)) + - [aci_communication_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/communication_policy) ([commPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commPol/overview)) + - [aci_tp](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tp) ([commRsClientCertCA](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commRsClientCertCA/overview)) + - [aci_key_ring](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/key_ring) ([commRsKeyRing](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commRsKeyRing/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_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)) diff --git a/docs/resources/communication_policy.md b/docs/resources/communication_policy.md new file mode 100644 index 000000000..c9971c1a8 --- /dev/null +++ b/docs/resources/communication_policy.md @@ -0,0 +1,201 @@ +--- +# 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: "Generic" +layout: "aci" +page_title: "ACI: aci_communication_policy" +sidebar_current: "docs-aci-resource-aci_communication_policy" +description: |- + Manages ACI Communication Policy +--- + +# aci_communication_policy # + +Manages ACI Communication Policy + + + +## API Information ## + +* Class: [commPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commPol/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/fabric/comm-{name}` + +## GUI Information ## + +* Location: `Generic` + +## Example Usage ## + +The configuration snippet below creates a Communication Policy with only required attributes. + +```hcl + +resource "aci_communication_policy" "example" { + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the Communication Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_communication_policy" "full_example" { + annotation = "annotation" + description = "description" + name = "test_name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + strict_security_on_apic_oob_subnet = "no" + http_ssl_configuration = [ + { + access_control_allow_credential = "disabled" + access_control_allow_origins = "access_control_allow_origins_1" + admin_st = "disabled" + annotation = "annotation_1" + cli_only_mode = "disabled" + client_cert_auth_state = "disabled" + description = "description_1" + dh_param = "1024" + global_throttle_rate = "global_throttle_rate_1" + global_throttle_st = "disabled" + global_throttle_unit = "global_throttle_unit_1" + max_request_status_count = "max_request_status_count_1" + name = "name_1" + name_alias = "name_alias_1" + node_exporter = "disabled" + port = "port_1" + referer = "referer_1" + server_header = "disabled" + ssl_protocols = "TLSv1" + throttle_rate = "throttle_rate_1" + throttle_st = "disabled" + visore_access = "disabled" + } + ] + annotations = [ + { + key = "annotations_1" + value = "value_1" + } + ] +} + +``` + +All examples for the Communication Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_communication_policy) folder. + +## Schema ## + +### Required ### + +* `name` (name) - (string) The name of the Communication Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Communication Policy object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Communication Policy object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Communication Policy object. +* `name_alias` (nameAlias) - (string) The name alias of the Communication Policy 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. +* `strict_security_on_apic_oob_subnet` (strictSecurityOnApicOOBSubnet) - (string) remove implicit access on apic oob from any apic OOB subnet IP. + - Default: `false` + - Valid Values: `no`, `yes`. + +* `http_ssl_configuration` - (list) A list of Http Ssl Configuration objects ([commHttps](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/commHttps/overview)). Http Ssl Configuration can also be configured using a separate [aci_](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/) resource. + + #### Required #### + + + #### Optional #### + + * `access_control_allow_credential` (accessControlAllowCredential) - (string) accessControlAllowCredential. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. + * `access_control_allow_origins` (accessControlAllowOrigins) - (string) + * `admin_st` (adminSt) - (string) The state of HTTPS communication service. This can be enabled or disabled. + - Default: `enabled` + - Valid Values: `disabled`, `enabled`. + * `annotation` (annotation) - (string) The annotation of the Http Ssl Configuration object. + - Default: `orchestrator:terraform` + * `cli_only_mode` (cliOnlyMode) - (string) CLI only mode. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. + * `client_cert_auth_state` (clientCertAuthState) - (string) Client Cert Auth State. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. + * `description` (descr) - (string) The description of the Http Ssl Configuration object. + * `dh_param` (dhParam) - (string) DH Parameter. + - Default: `none` + - Valid Values: `1024`, `2048`, `4096`, `none`. + * `global_throttle_rate` (globalThrottleRate) - (string) The maximum MO api calls allowed per unit time. + - Default: `10000.000000` + * `global_throttle_st` (globalThrottleSt) - (string) Throttle state for all clients without tag0 in header. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. + * `global_throttle_unit` (globalThrottleUnit) - (string) Unit of rate limit. + - Default: `r/s` + * `max_request_status_count` (maxRequestStatusCount) - (string) The maximum number of request status objects to keep. + * `name` (name) - (string) The name of the Http Ssl Configuration object. + - Default: `https` + * `name_alias` (nameAlias) - (string) The name alias of the Http Ssl Configuration object. + * `node_exporter` (nodeExporter) - (string) Node Exporter service. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. + * `port` (port) - (string) The port used for HTTPS communication service. + - Default: `443.000000` + * `referer` (referer) - (string) Allowed HTTP referer space separated list. + * `server_header` (serverHeader) - (string) Server Header. + - Default: `enabled` + - Valid Values: `disabled`, `enabled`. + * `ssl_protocols` (sslProtocols) - (list) The Secure Socket Layer (SSL) protocol. + - Default: `TLSv1.1,TLSv1.2` + - Valid Values: `TLSv1`, `TLSv1.1`, `TLSv1.2`, `TLSv1.3`. + * `throttle_rate` (throttleRate) - (string) The maximum login/refresh allowed per second. + - Default: `2.000000` + * `throttle_st` (throttleSt) - (string) Login/refresh throttle state. + - Default: `enabled` + - Valid Values: `disabled`, `enabled`. + * `visore_access` (visoreAccess) - (string) Visore Access. + - Default: `enabled` + - Valid Values: `disabled`, `enabled`. + +* `annotations` - (list) A list of Annotations objects ([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. + +## Importing + +An existing Communication Policy 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_communication_policy.example uni/fabric/comm-{name} +``` + +Starting in Terraform version 1.5, an existing Communication Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/fabric/comm-{name}" + to = aci_communication_policy.example +} +``` + +## Child Resources + + - [aci_http_ssl_configuration](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/http_ssl_configuration) \ No newline at end of file diff --git a/examples/data-sources/aci_communication_policy/data-source.tf b/examples/data-sources/aci_communication_policy/data-source.tf new file mode 100644 index 000000000..65b195f27 --- /dev/null +++ b/examples/data-sources/aci_communication_policy/data-source.tf @@ -0,0 +1,4 @@ + +data "aci_communication_policy" "example" { + name = "test_name" +} diff --git a/examples/data-sources/aci_communication_policy/provider.tf b/examples/data-sources/aci_communication_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_communication_policy/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_communication_policy/provider.tf b/examples/resources/aci_communication_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_communication_policy/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_communication_policy/resource-all-attributes.tf b/examples/resources/aci_communication_policy/resource-all-attributes.tf new file mode 100644 index 000000000..9797a184f --- /dev/null +++ b/examples/resources/aci_communication_policy/resource-all-attributes.tf @@ -0,0 +1,42 @@ + +resource "aci_communication_policy" "full_example" { + annotation = "annotation" + description = "description" + name = "test_name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + strict_security_on_apic_oob_subnet = "no" + http_ssl_configuration = [ + { + access_control_allow_credential = "disabled" + access_control_allow_origins = "access_control_allow_origins_1" + admin_st = "disabled" + annotation = "annotation_1" + cli_only_mode = "disabled" + client_cert_auth_state = "disabled" + description = "description_1" + dh_param = "1024" + global_throttle_rate = "global_throttle_rate_1" + global_throttle_st = "disabled" + global_throttle_unit = "global_throttle_unit_1" + max_request_status_count = "max_request_status_count_1" + name = "name_1" + name_alias = "name_alias_1" + node_exporter = "disabled" + port = "port_1" + referer = "referer_1" + server_header = "disabled" + ssl_protocols = "TLSv1" + throttle_rate = "throttle_rate_1" + throttle_st = "disabled" + visore_access = "disabled" + } + ] + annotations = [ + { + key = "annotations_1" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_communication_policy/resource.tf b/examples/resources/aci_communication_policy/resource.tf new file mode 100644 index 000000000..36e5d6cfe --- /dev/null +++ b/examples/resources/aci_communication_policy/resource.tf @@ -0,0 +1,4 @@ + +resource "aci_communication_policy" "example" { + name = "test_name" +} diff --git a/gen/generator.go b/gen/generator.go index f101656c3..7d219351f 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -278,7 +278,7 @@ func getClassModels(definitions Definitions) map[string]Model { for _, pkgName := range pkgNames { classModel := Model{PkgName: pkgName} - classModel.setClassModel(metaPath, false, definitions, []string{}, pkgNames) + classModel.setClassModel(metaPath, false, definitions, []string{}, pkgNames, nil) classModels[pkgName] = classModel } return classModels @@ -529,20 +529,10 @@ func main() { // When done before additional files would need to be opened and read which would slow down the generation process model.ResourceName = GetResourceName(model.PkgName, definitions) model.RelationshipResourceName = GetResourceName(model.RelationshipClass, definitions) - childMap := make(map[string]Model, 0) - for childName, childModel := range model.Children { - childModel.ChildResourceName = GetResourceName(childModel.PkgName, definitions) - if len(childModel.IdentifiedBy) > 0 { - // TODO add logic to determine the naming for plural child resources - childModel.ResourceNameDocReference = childModel.ChildResourceName - childModel.ResourceName = fmt.Sprintf("%ss", childModel.ChildResourceName) - } else { - childModel.ResourceName = childModel.ChildResourceName - } - childModel.RelationshipResourceName = GetResourceName(childModel.RelationshipClass, definitions) - childMap[childName] = childModel - } - model.Children = childMap + model.Children = SetChildClassNames(definitions, model.Children) + // for key, val := range model.Children { + // log.Printf("HERE %v %v", key, val.Children) + // } // Set the documentation specific information for the resource // This is done to ensure references can be made to parent/child resources and output amounts can be restricted @@ -619,6 +609,7 @@ type Model struct { RelationshipClass string RelationshipResourceName string Versions string + ParentName string ChildClasses []string ContainedBy []string Contains []string @@ -688,7 +679,7 @@ type Definitions struct { } // Reads the class details from the meta file and sets all details to the Model -func (m *Model) setClassModel(metaPath string, child bool, definitions Definitions, parents, pkgNames []string) { +func (m *Model) setClassModel(metaPath string, isChildIteration bool, definitions Definitions, parents, pkgNames, mainParentChildren []string) { fileContent, err := os.ReadFile(fmt.Sprintf("%s/%s.json", metaPath, m.PkgName)) if err != nil { log.Fatal("Error when opening file: ", err) @@ -705,7 +696,7 @@ func (m *Model) setClassModel(metaPath string, child bool, definitions Definitio m.Configuration = GetClassConfiguration(m.PkgName, definitions) for _, classDetails := range classInfo { - m.SetClassLabel(classDetails, child) + m.SetClassLabel(classDetails) m.SetClassName(classDetails) m.SetClassRnFormat(classDetails) m.SetClassDnFormats(classDetails) @@ -717,7 +708,10 @@ func (m *Model) setClassModel(metaPath string, child bool, definitions Definitio m.SetClassComment(classDetails) m.SetClassVersions(classDetails) m.SetClassProperties(classDetails) - m.SetClassChildren(classDetails, pkgNames) + m.SetClassChildren(classDetails, pkgNames, mainParentChildren) + if len(parents) != 0 { + m.SetParentName(parents) + } m.SetResourceNotesAndWarnigns(m.PkgName, definitions) } @@ -727,38 +721,38 @@ func (m *Model) setClassModel(metaPath string, child bool, definitions Definitio - Incorrect: Parent -> Child -> Grandchild // TODO add grandchild logic */ - if !child { - if len(m.ChildClasses) > 0 { - m.HasChild = true - m.Children = make(map[string]Model) - for _, child := range m.ChildClasses { - childModel := Model{PkgName: child} - childModel.setClassModel(metaPath, true, definitions, []string{m.PkgName}, pkgNames) - m.Children[child] = childModel - if childModel.HasValidValues { - m.HasValidValues = true - } - if len(childModel.IdentifiedBy) == 0 { - m.HasChildWithoutIdentifier = true - } - if childModel.AllowDelete { - m.AllowChildDelete = true - } - if childModel.HasBitmask { - m.HasBitmask = true - } - if childModel.HasNamedProperties { - m.HasNamedProperties = true - m.HasChildNamedProperties = true - } + + if len(m.ChildClasses) > 0 { + mainParentChildren := append(mainParentChildren, m.ChildClasses...) + m.HasChild = true + m.Children = make(map[string]Model) + for _, child := range m.ChildClasses { + childModel := Model{PkgName: child} + childModel.setClassModel(metaPath, true, definitions, []string{m.ResourceClassName}, pkgNames, mainParentChildren) + m.Children[child] = childModel + if childModel.HasValidValues { + m.HasValidValues = true + } + if len(childModel.IdentifiedBy) == 0 { + m.HasChildWithoutIdentifier = true + } + if childModel.AllowDelete { + m.AllowChildDelete = true + } + if childModel.HasBitmask { + m.HasBitmask = true + } + if childModel.HasNamedProperties { + m.HasNamedProperties = true + m.HasChildNamedProperties = true } - } else { - m.HasChild = false } + } else { + m.HasChild = false } } -func (m *Model) SetClassLabel(classDetails interface{}, child bool) { +func (m *Model) SetClassLabel(classDetails interface{}) { m.Label = cleanLabel(classDetails.(map[string]interface{})["label"].(string)) if slices.Contains(labels, m.Label) || m.Label == "" { if !slices.Contains(duplicateLabels, m.Label) { @@ -842,14 +836,14 @@ func (m *Model) SetClassIdentifiers(classDetails interface{}) { m.IdentifiedBy = uniqueInterfaceSlice(classDetails.(map[string]interface{})["identifiedBy"].([]interface{})) } -func (m *Model) SetClassChildren(classDetails interface{}, pkgNames []string) { +func (m *Model) SetClassChildren(classDetails interface{}, pkgNames, mainParentChildren []string) { childClasses := []string{} rnMap := classDetails.(map[string]interface{})["rnMap"].(map[string]interface{}) for rn, className := range rnMap { // TODO check if this condition is correct since there might be cases where that we should exclude if !strings.HasSuffix(rn, "-") || strings.HasPrefix(rn, "rs") || className.(string) == "tag:Annotation" { pkgName := strings.ReplaceAll(className.(string), ":", "") - if slices.Contains(pkgNames, pkgName) { + if slices.Contains(pkgNames, pkgName) && !slices.Contains(mainParentChildren, pkgName) { childClasses = append(childClasses, pkgName) } } @@ -868,6 +862,25 @@ func (m *Model) SetClassChildren(classDetails interface{}, pkgNames []string) { m.ChildClasses = uniqueStringSlice(childClasses) } +func SetChildClassNames(definitions Definitions, children map[string]Model) map[string]Model { + childMap := make(map[string]Model, 0) + for childName, childModel := range children { + childModel.ChildResourceName = GetResourceName(childModel.PkgName, definitions) + if len(childModel.IdentifiedBy) > 0 { + // TODO add logic to determine the naming for plural child resources + childModel.ResourceNameDocReference = childModel.ChildResourceName + childModel.ResourceName = fmt.Sprintf("%ss", childModel.ChildResourceName) + } else { + childModel.ResourceName = childModel.ChildResourceName + } + childModel.RelationshipResourceName = GetResourceName(childModel.RelationshipClass, definitions) + childModel.Children = SetChildClassNames(definitions, childModel.Children) + + childMap[childName] = childModel + } + return childMap +} + func (m *Model) SetClassInclude() { if classDetails, ok := m.Definitions.Classes[m.PkgName]; ok { for key, value := range classDetails.(map[interface{}]interface{}) { @@ -888,6 +901,10 @@ func (m *Model) SetClassAllowDelete(classDetails interface{}) { } } +func (m *Model) SetParentName(classPkgName []string) { + m.ParentName = classPkgName[0] +} + // Determine if a class is allowed to be deleted as defined in the classes.yaml file // Flag created to ensure classes that only classes allowed to be deleted are deleted func (m *Model) SetResourceNotesAndWarnigns(classPkgName string, definitions Definitions) { diff --git a/gen/meta/commHttps.json b/gen/meta/commHttps.json new file mode 100644 index 000000000..a44c83aa6 --- /dev/null +++ b/gen/meta/commHttps.json @@ -0,0 +1,1798 @@ +{ + "comm:Https": { + "contains": { + "aaa:RbacAnnotation": "", + "comm:Cipher": "", + "comm:RsClientCertCA": "", + "comm:RsKeyRing": "", + "comm:RtCpmCommHttps": "", + "comm:WebConnAg15min": "", + "comm:WebConnAg1d": "", + "comm:WebConnAg1h": "", + "comm:WebConnAg1mo": "", + "comm:WebConnAg1qtr": "", + "comm:WebConnAg1w": "", + "comm:WebConnAg1year": "", + "comm:WebConnAgHist15min": "", + "comm:WebConnAgHist1d": "", + "comm:WebConnAgHist1h": "", + "comm:WebConnAgHist1mo": "", + "comm:WebConnAgHist1qtr": "", + "comm:WebConnAgHist1w": "", + "comm:WebConnAgHist1year": "", + "comm:WebConnStatesAg15min": "", + "comm:WebConnStatesAg1d": "", + "comm:WebConnStatesAg1h": "", + "comm:WebConnStatesAg1mo": "", + "comm:WebConnStatesAg1qtr": "", + "comm:WebConnStatesAg1w": "", + "comm:WebConnStatesAg1year": "", + "comm:WebConnStatesAgHist15min": "", + "comm:WebConnStatesAgHist1d": "", + "comm:WebConnStatesAgHist1h": "", + "comm:WebConnStatesAgHist1mo": "", + "comm:WebConnStatesAgHist1qtr": "", + "comm:WebConnStatesAgHist1w": "", + "comm:WebConnStatesAgHist1year": "", + "comm:WebProxy": "", + "comm:WebReqAg15min": "", + "comm:WebReqAg1d": "", + "comm:WebReqAg1h": "", + "comm:WebReqAg1mo": "", + "comm:WebReqAg1qtr": "", + "comm:WebReqAg1w": "", + "comm:WebReqAg1year": "", + "comm:WebReqAgHist15min": "", + "comm:WebReqAgHist1d": "", + "comm:WebReqAgHist1h": "", + "comm:WebReqAgHist1mo": "", + "comm:WebReqAgHist1qtr": "", + "comm:WebReqAgHist1w": "", + "comm:WebReqAgHist1year": "", + "fault:Counts": "", + "fault:Delegate": "", + "fault:Inst": "", + "health:Inst": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "CDcommWebConnAg15min": "comm:WebConnAg15min", + "CDcommWebConnAg1d": "comm:WebConnAg1d", + "CDcommWebConnAg1h": "comm:WebConnAg1h", + "CDcommWebConnAg1mo": "comm:WebConnAg1mo", + "CDcommWebConnAg1qtr": "comm:WebConnAg1qtr", + "CDcommWebConnAg1w": "comm:WebConnAg1w", + "CDcommWebConnAg1year": "comm:WebConnAg1year", + "CDcommWebConnStatesAg15min": "comm:WebConnStatesAg15min", + "CDcommWebConnStatesAg1d": "comm:WebConnStatesAg1d", + "CDcommWebConnStatesAg1h": "comm:WebConnStatesAg1h", + "CDcommWebConnStatesAg1mo": "comm:WebConnStatesAg1mo", + "CDcommWebConnStatesAg1qtr": "comm:WebConnStatesAg1qtr", + "CDcommWebConnStatesAg1w": "comm:WebConnStatesAg1w", + "CDcommWebConnStatesAg1year": "comm:WebConnStatesAg1year", + "CDcommWebReqAg15min": "comm:WebReqAg15min", + "CDcommWebReqAg1d": "comm:WebReqAg1d", + "CDcommWebReqAg1h": "comm:WebReqAg1h", + "CDcommWebReqAg1mo": "comm:WebReqAg1mo", + "CDcommWebReqAg1qtr": "comm:WebReqAg1qtr", + "CDcommWebReqAg1w": "comm:WebReqAg1w", + "CDcommWebReqAg1year": "comm:WebReqAg1year", + "HDcommWebConnAg15min-": "comm:WebConnAgHist15min", + "HDcommWebConnAg1d-": "comm:WebConnAgHist1d", + "HDcommWebConnAg1h-": "comm:WebConnAgHist1h", + "HDcommWebConnAg1mo-": "comm:WebConnAgHist1mo", + "HDcommWebConnAg1qtr-": "comm:WebConnAgHist1qtr", + "HDcommWebConnAg1w-": "comm:WebConnAgHist1w", + "HDcommWebConnAg1year-": "comm:WebConnAgHist1year", + "HDcommWebConnStatesAg15min-": "comm:WebConnStatesAgHist15min", + "HDcommWebConnStatesAg1d-": "comm:WebConnStatesAgHist1d", + "HDcommWebConnStatesAg1h-": "comm:WebConnStatesAgHist1h", + "HDcommWebConnStatesAg1mo-": "comm:WebConnStatesAgHist1mo", + "HDcommWebConnStatesAg1qtr-": "comm:WebConnStatesAgHist1qtr", + "HDcommWebConnStatesAg1w-": "comm:WebConnStatesAgHist1w", + "HDcommWebConnStatesAg1year-": "comm:WebConnStatesAgHist1year", + "HDcommWebReqAg15min-": "comm:WebReqAgHist15min", + "HDcommWebReqAg1d-": "comm:WebReqAgHist1d", + "HDcommWebReqAg1h-": "comm:WebReqAgHist1h", + "HDcommWebReqAg1mo-": "comm:WebReqAgHist1mo", + "HDcommWebReqAg1qtr-": "comm:WebReqAgHist1qtr", + "HDcommWebReqAg1w-": "comm:WebReqAgHist1w", + "HDcommWebReqAg1year-": "comm:WebReqAgHist1year", + "annotationKey-": "tag:Annotation", + "cph-": "comm:Cipher", + "fault-": "fault:Inst", + "fd-": "fault:Delegate", + "fltCnts": "fault:Counts", + "health": "health:Inst", + "rbacDom-": "aaa:RbacAnnotation", + "rsKeyRing": "comm:RsKeyRing", + "rsclientCertCA": "comm:RsClientCertCA", + "rtpolCpmCommHttps-": "comm:RtCpmCommHttps", + "tagKey-": "tag:Tag", + "wp-": "comm:WebProxy" + }, + "identifiedBy": [ + + ], + "rnFormat": "https", + "containedBy": { + "comm:Pol": "" + }, + "superClasses": [ + "comm:Web", + "comm:Comp", + "pol:Comp", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "comm:RtCpmCommHttps": "pol:DefRelnHolder" + }, + "relationTo": { + "comm:RsClientCertCA": "pki:TP", + "comm:RsKeyRing": "pki:KeyRing" + }, + "dnFormats": [ + "uni/fabric/comm-{name}/https" + ], + "writeAccess": [ + "aaa", + "admin" + ], + "readAccess": [ + "aaa", + "admin", + "fabric-equipment" + ], + "faults": { + + }, + "events": { + "E4205022": "modification||comm:Https", + "E4211222": "creation||comm:Https", + "E4211223": "modification||comm:Https", + "E4211224": "deletion||comm:Https" + }, + "stats": { + "comm:WebConnAg15min": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections in a 15 minute sampling interval. This class updates every 5 minutes." + ] + }, + "comm:WebConnAg1d": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections in a 1 day sampling interval. This class updates every hour." + ] + }, + "comm:WebConnAg1h": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections in a 1 hour sampling interval. This class updates every 15 minutes." + ] + }, + "comm:WebConnAg1mo": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections in a 1 month sampling interval. This class updates every day." + ] + }, + "comm:WebConnAg1qtr": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections in a 1 quarter sampling interval. This class updates every day." + ] + }, + "comm:WebConnAg1w": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections in a 1 week sampling interval. This class updates every day." + ] + }, + "comm:WebConnAg1year": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections in a 1 year sampling interval. This class updates every day." + ] + }, + "comm:WebConnAgHist15min": { + "comment": [ + "A class that represents historical aggregated statistics for web connections in a 15 minute sampling interval. This class updates every 5 minutes." + ] + }, + "comm:WebConnAgHist1d": { + "comment": [ + "A class that represents historical aggregated statistics for web connections in a 1 day sampling interval. This class updates every hour." + ] + }, + "comm:WebConnAgHist1h": { + "comment": [ + "A class that represents historical aggregated statistics for web connections in a 1 hour sampling interval. This class updates every 15 minutes." + ] + }, + "comm:WebConnAgHist1mo": { + "comment": [ + "A class that represents historical aggregated statistics for web connections in a 1 month sampling interval. This class updates every day." + ] + }, + "comm:WebConnAgHist1qtr": { + "comment": [ + "A class that represents historical aggregated statistics for web connections in a 1 quarter sampling interval. This class updates every day." + ] + }, + "comm:WebConnAgHist1w": { + "comment": [ + "A class that represents historical aggregated statistics for web connections in a 1 week sampling interval. This class updates every day." + ] + }, + "comm:WebConnAgHist1year": { + "comment": [ + "A class that represents historical aggregated statistics for web connections in a 1 year sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAg15min": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections state in a 15 minute sampling interval. This class updates every 5 minutes." + ] + }, + "comm:WebConnStatesAg1d": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections state in a 1 day sampling interval. This class updates every hour." + ] + }, + "comm:WebConnStatesAg1h": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections state in a 1 hour sampling interval. This class updates every 15 minutes." + ] + }, + "comm:WebConnStatesAg1mo": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections state in a 1 month sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAg1qtr": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections state in a 1 quarter sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAg1w": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections state in a 1 week sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAg1year": { + "comment": [ + "A class that represents the most current aggregated statistics for web connections state in a 1 year sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAgHist15min": { + "comment": [ + "A class that represents historical aggregated statistics for web connections state in a 15 minute sampling interval. This class updates every 5 minutes." + ] + }, + "comm:WebConnStatesAgHist1d": { + "comment": [ + "A class that represents historical aggregated statistics for web connections state in a 1 day sampling interval. This class updates every hour." + ] + }, + "comm:WebConnStatesAgHist1h": { + "comment": [ + "A class that represents historical aggregated statistics for web connections state in a 1 hour sampling interval. This class updates every 15 minutes." + ] + }, + "comm:WebConnStatesAgHist1mo": { + "comment": [ + "A class that represents historical aggregated statistics for web connections state in a 1 month sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAgHist1qtr": { + "comment": [ + "A class that represents historical aggregated statistics for web connections state in a 1 quarter sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAgHist1w": { + "comment": [ + "A class that represents historical aggregated statistics for web connections state in a 1 week sampling interval. This class updates every day." + ] + }, + "comm:WebConnStatesAgHist1year": { + "comment": [ + "A class that represents historical aggregated statistics for web connections state in a 1 year sampling interval. This class updates every day." + ] + }, + "comm:WebReqAg15min": { + "comment": [ + "A class that represents the most current aggregated statistics for web requests in a 15 minute sampling interval. This class updates every 5 minutes." + ] + }, + "comm:WebReqAg1d": { + "comment": [ + "A class that represents the most current aggregated statistics for web requests in a 1 day sampling interval. This class updates every hour." + ] + }, + "comm:WebReqAg1h": { + "comment": [ + "A class that represents the most current aggregated statistics for web requests in a 1 hour sampling interval. This class updates every 15 minutes." + ] + }, + "comm:WebReqAg1mo": { + "comment": [ + "A class that represents the most current aggregated statistics for web requests in a 1 month sampling interval. This class updates every day." + ] + }, + "comm:WebReqAg1qtr": { + "comment": [ + "A class that represents the most current aggregated statistics for web requests in a 1 quarter sampling interval. This class updates every day." + ] + }, + "comm:WebReqAg1w": { + "comment": [ + "A class that represents the most current aggregated statistics for web requests in a 1 week sampling interval. This class updates every day." + ] + }, + "comm:WebReqAg1year": { + "comment": [ + "A class that represents the most current aggregated statistics for web requests in a 1 year sampling interval. This class updates every day." + ] + }, + "comm:WebReqAgHist15min": { + "comment": [ + "A class that represents historical aggregated statistics for web requests in a 15 minute sampling interval. This class updates every 5 minutes." + ] + }, + "comm:WebReqAgHist1d": { + "comment": [ + "A class that represents historical aggregated statistics for web requests in a 1 day sampling interval. This class updates every hour." + ] + }, + "comm:WebReqAgHist1h": { + "comment": [ + "A class that represents historical aggregated statistics for web requests in a 1 hour sampling interval. This class updates every 15 minutes." + ] + }, + "comm:WebReqAgHist1mo": { + "comment": [ + "A class that represents historical aggregated statistics for web requests in a 1 month sampling interval. This class updates every day." + ] + }, + "comm:WebReqAgHist1qtr": { + "comment": [ + "A class that represents historical aggregated statistics for web requests in a 1 quarter sampling interval. This class updates every day." + ] + }, + "comm:WebReqAgHist1w": { + "comment": [ + "A class that represents historical aggregated statistics for web requests in a 1 week sampling interval. This class updates every day." + ] + }, + "comm:WebReqAgHist1year": { + "comment": [ + "A class that represents historical aggregated statistics for web requests in a 1 year sampling interval. This class updates every day." + ] + } + }, + "versions": "1.0(1e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": true, + "hasStats": true, + "isStat": false, + "isFaultable": true, + "isDomainable": false, + "isHealthScorable": true, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "ambiguous", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "never", + "platformFlavors": [ + + ], + "classId": "1578", + "className": "Https", + "classPkg": "comm", + "featureTag": "", + "moCategory": "Regular", + "label": "HTTP SSL Configuration", + "comment": [ + "HTTPS" + ], + "properties": { + "accessControlAllowCredential": { + "versions": "2.3(1e)-", + "isConfigurable": true, + "propGlobalId": "33388", + "propLocalId": "7960", + "label": "accessControlAllowCredential", + "baseType": "scalar:Enum8", + "modelType": "comm:AllowCredentialState", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "accessControlAllowOrigins": { + "versions": "1.1(1j)-", + "comment": [ + "" + ], + "isConfigurable": true, + "propGlobalId": "17866", + "propLocalId": "4636", + "label": "accessControlAllowOrigins", + "baseType": "string:Basic", + "modelType": "comm:UrlList", + "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": 256, + "regexs": [ + {"regex" : "^[a-zA-Z0-9-_:/.,\\*\\s]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "adminSt": { + "versions": "1.0(1e)-", + "comment": [ + "The state of HTTPS communication service. This can be enabled or disabled." + ], + "isConfigurable": true, + "propGlobalId": "1298", + "propLocalId": "46", + "label": "Admin State", + "baseType": "scalar:Enum8", + "modelType": "comm:AdminState", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validValues": [ + { "value": "enabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "enabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "37532", + "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 + }, + "cliOnlyMode": { + "versions": "4.1(1i)-", + "isConfigurable": true, + "propGlobalId": "47672", + "propLocalId": "10837", + "label": "CLI only mode", + "baseType": "scalar:Enum8", + "modelType": "comm:CliOnlyMode", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "clientCertAuthState": { + "versions": "4.0(1h)-", + "isConfigurable": true, + "propGlobalId": "42733", + "propLocalId": "9258", + "label": "Client Cert Auth State", + "baseType": "scalar:Enum8", + "modelType": "comm:AdminState", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies the description of a policy component." + ], + "isConfigurable": true, + "propGlobalId": "5582", + "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": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dhParam": { + "versions": "1.2(2g)-", + "isConfigurable": true, + "propGlobalId": "24294", + "propLocalId": "5842", + "label": "DH Parameter", + "baseType": "scalar:Enum8", + "modelType": "comm:DHParam", + "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": "1024", + "platformFlavors": [ + + ], + "label": "1024 "}, + { "value": "2", "localName": "2048", + "platformFlavors": [ + + ], + "label": "2048 "}, + { "value": "3", "localName": "4096", + "platformFlavors": [ + + ], + "label": "4096 "}, + { "value": "none", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "label": "None "} + ], + "default": "none", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": true, + "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": "39671", + "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 + }, + "globalThrottleRate": { + "versions": "4.2(1i)-", + "isConfigurable": true, + "propGlobalId": "52997", + "propLocalId": "12189", + "label": "The maximum MO api calls allowed per unit time", + "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, + "validators": [ + {"min" : 1, "max": 10000 } + ], + "validValues": [ + { "value": "10000", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 10000, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "globalThrottleSt": { + "versions": "4.2(1i)-", + "isConfigurable": true, + "propGlobalId": "52996", + "propLocalId": "12188", + "label": "Throttle state for all clients without tag0 in header", + "baseType": "scalar:Enum8", + "modelType": "comm:AdminState", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "globalThrottleUnit": { + "versions": "4.2(1i)-", + "isConfigurable": true, + "propGlobalId": "52998", + "propLocalId": "12190", + "label": "Unit of rate limit", + "baseType": "string:Basic", + "modelType": "comm:RateUnitType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"regex" : "^[r]/[ms]$", "type": "include"} + ], + "validValues": [ + { "value": "r/s", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "r/s", + "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 + }, + "maxRequestStatusCount": { + "versions": "1.1(1j)-", + "isConfigurable": true, + "propGlobalId": "19814", + "propLocalId": "5134", + "label": "The maximum number of request status objects to keep", + "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, + "validators": [ + {"min" : 0, "max": 1024 } + ], + "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 + }, + "monPolDn": { + "versions": "1.0(1e)-", + "comment": [ + "The monitoring policy attached to this observable object." + ], + "isConfigurable": false, + "propGlobalId": "14145", + "propLocalId": "228", + "label": "Monitoring Policy", + "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 + }, + "name": { + "versions": "1.0(1e)-", + "comment": [ + "null" + ], + "isConfigurable": true, + "propGlobalId": "1296", + "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"} + ] + } + ], + "validValues": [ + { "value": "https", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "https", + "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 + }, + "nodeExporter": { + "versions": "5.2(3e)-", + "isConfigurable": true, + "propGlobalId": "65281", + "propLocalId": "14483", + "label": "Node Exporter service", + "baseType": "scalar:Enum8", + "modelType": "comm:NodeExporter", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "port": { + "versions": "1.0(1e)-", + "comment": [ + "The port used for HTTPS communication service." + ], + "isConfigurable": true, + "propGlobalId": "1297", + "propLocalId": "127", + "label": "Port", + "baseType": "scalar:Uint32", + "modelType": "comm:Port", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 65535 } + ], + "validValues": [ + { "value": "443", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 443, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "proto": { + "versions": "1.0(1e)-", + "comment": [ + "The list of protocols to match." + ], + "isConfigurable": false, + "propGlobalId": "1289", + "propLocalId": "144", + "label": "proto", + "baseType": "scalar:Enum8", + "modelType": "comm:Protocol", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validValues": [ + { "value": "3", "localName": "all", + "platformFlavors": [ + + ], + "label": "All "}, + { "value": "tcp", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "label": "None "}, + { "value": "1", "localName": "tcp", + "platformFlavors": [ + + ], + "label": "tcp "}, + { "value": "2", "localName": "udp", + "platformFlavors": [ + + ], + "label": "udp "} + ], + "default": "tcp", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "referer": { + "versions": "6.0(2h)-", + "isConfigurable": true, + "propGlobalId": "69126", + "propLocalId": "15056", + "label": "Allowed HTTP referer space separated list", + "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 } + ], + "validValues": [ + { "value": "", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "", + "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 + }, + "serverHeader": { + "versions": "5.2(1g)-", + "isConfigurable": true, + "propGlobalId": "63694", + "propLocalId": "13996", + "label": "Server Header", + "baseType": "scalar:Enum8", + "modelType": "comm:ServerHeader", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "enabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "enabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "sslProtocols": { + "versions": "1.1(1j)-", + "comment": [ + "The Secure Socket Layer (SSL) protocol." + ], + "isConfigurable": true, + "propGlobalId": "18247", + "propLocalId": "4711", + "label": "SSL Protocols", + "baseType": "scalar:Bitmask64", + "modelType": "comm:SslProtocolTypes", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "1", "localName": "TLSv1", + "platformFlavors": [ + + ], + "label": "TLSv1 "}, + { "value": "2", "localName": "TLSv1.1", + "platformFlavors": [ + + ], + "label": "TLSv1.1 "}, + { "value": "4", "localName": "TLSv1.2", + "platformFlavors": [ + + ], + "label": "TLSv1.2 "}, + { "value": "8", "localName": "TLSv1.3", + "platformFlavors": [ + + ], + "label": "TLSv1.3 "}, + { "value": "TLSv1.1,TLSv1.2", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "TLSv1.1,TLSv1.2", + "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 + }, + "throttleRate": { + "versions": "3.1(1i)-", + "isConfigurable": true, + "propGlobalId": "36782", + "propLocalId": "8597", + "label": "The maximum login/refresh allowed per second", + "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, + "validators": [ + {"min" : 1, "max": 100 } + ], + "validValues": [ + { "value": "2", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": 2, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "throttleSt": { + "versions": "3.1(1i)-", + "isConfigurable": true, + "propGlobalId": "36781", + "propLocalId": "8596", + "label": "Login/refresh throttle state", + "baseType": "scalar:Enum8", + "modelType": "comm:AdminState", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "enabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "enabled", + "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 + }, + "visoreAccess": { + "versions": "3.1(1i)-", + "isConfigurable": true, + "propGlobalId": "35417", + "propLocalId": "8263", + "label": "Visore Access", + "baseType": "scalar:Enum8", + "modelType": "comm:VisoreAccess", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "enabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "Disabled "}, + { "value": "1", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "Enabled "} + ], + "default": "enabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/commPol.json b/gen/meta/commPol.json new file mode 100644 index 000000000..9a0f3325d --- /dev/null +++ b/gen/meta/commPol.json @@ -0,0 +1,800 @@ +{ + "comm:Pol": { + "contains": { + "aaa:RbacAnnotation": "", + "comm:ApiRespTime": "", + "comm:Http": "", + "comm:Https": "", + "comm:Reconfig": "", + "comm:RtCommPol": "", + "comm:RtPol": "", + "comm:RtResPol": "", + "comm:RtWebCommDefault": "", + "comm:RtWebCommPolRel": "", + "comm:Setup": "", + "comm:Shellinabox": "", + "comm:Ssh": "", + "comm:Telnet": "", + "fault:Counts": "", + "fault:Delegate": "", + "health:Inst": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "apiResp": "comm:ApiRespTime", + "fd-": "fault:Delegate", + "fltCnts": "fault:Counts", + "health": "health:Inst", + "http": "comm:Http", + "https": "comm:Https", + "rbacDom-": "aaa:RbacAnnotation", + "reconfig": "comm:Reconfig", + "rtaaaPol-": "comm:RtPol", + "rtfabricCommPol-": "comm:RtCommPol", + "rtfabricResPol-": "comm:RtResPol", + "rtwebCommDefault-": "comm:RtWebCommDefault", + "rtwebCommPolRel": "comm:RtWebCommPolRel", + "setup": "comm:Setup", + "shellinabox": "comm:Shellinabox", + "ssh": "comm:Ssh", + "tagKey-": "tag:Tag", + "telnet": "comm:Telnet" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "comm-{name}", + "containedBy": { + "fabric:Inst": "" + }, + "superClasses": [ + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "comm:RtCommPol": "fabric:PodPGrp", + "comm:RtPol": "aaa:SecRelnHolder", + "comm:RtResPol": "fabric:SecRelnHolder", + "comm:RtWebCommDefault": "comm:WebPolCont", + "comm:RtWebCommPolRel": "comm:WebPolCont" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/fabric/comm-{name}" + ], + "writeAccess": [ + "aaa", + "admin" + ], + "readAccess": [ + "aaa", + "admin", + "fabric-connectivity", + "fabric-equipment", + "fabric-protocol" + ], + "faults": { + + }, + "events": { + "E4211225": "creation||comm:Pol", + "E4211226": "modification||comm:Pol", + "E4211227": "deletion||comm:Pol" + }, + "stats": { + + }, + "versions": "1.0(1e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": true, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": true, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "ambiguous", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "1572", + "className": "Pol", + "classPkg": "comm", + "featureTag": "", + "moCategory": "Regular", + "label": "Communication Policy", + "comment": [ + "The communication policy contains the service configuration for various services." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "37529", + "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." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "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": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "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": "39668", + "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 + }, + "monPolDn": { + "versions": "1.0(1e)-", + "comment": [ + "The monitoring policy attached to this observable object." + ], + "isConfigurable": false, + "propGlobalId": "14144", + "propLocalId": "228", + "label": "Monitoring Policy", + "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 + }, + "name": { + "versions": "1.0(1e)-", + "comment": [ + "The name of the policy. This name can be up to 64 alphanumeric characters. Note that you cannot change this name after the object has been saved." + ], + "isConfigurable": true, + "propGlobalId": "5905", + "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 + }, + "strictSecurityOnApicOOBSubnet": { + "isConfigurable": true, + "propGlobalId": "70760", + "propLocalId": "15519", + "label": "remove implicit access on apic oob from any apic OOB subnet IP", + "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 + }, + "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/commRsClientCertCA.json b/gen/meta/commRsClientCertCA.json new file mode 100644 index 000000000..11dfd0982 --- /dev/null +++ b/gen/meta/commRsClientCertCA.json @@ -0,0 +1,912 @@ +{ + "comm:RsClientCertCA": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Counts": "", + "fault:Inst": "", + "health:Inst": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fault-": "fault:Inst", + "fltCnts": "fault:Counts", + "health": "health:Inst", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + + ], + "rnFormat": "rsclientCertCA", + "containedBy": { + "comm:Https": "" + }, + "superClasses": [ + "reln:To", + "reln:Inst" + ], + "subClasses": { + + }, + "relationInfo": { + "type": "explicit", + "cardinality": "n-to-1", + "fromMo": "comm:Https", + "fromRelMo": "comm:RsClientCertCA", + "toMo": "pki:TP", + "toRelMo": "pki:RtClientCertCA", + "enforceable": true, + "resolvable": true + }, + "dnFormats": [ + "uni/fabric/comm-{name}/https/rsclientCertCA" + ], + "writeAccess": [ + "aaa", + "admin" + ], + "readAccess": [ + "aaa", + "admin", + "fabric-equipment" + ], + "faults": { + "F3138": "fltCommRsClientCertCAResolveFail" + }, + "events": { + "E4215646": "creation||comm:RsClientCertCA", + "E4215647": "modification||comm:RsClientCertCA", + "E4215648": "deletion||comm:RsClientCertCA" + }, + "stats": { + + }, + "versions": "4.0(1h)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": true, + "hasStats": false, + "isStat": false, + "isFaultable": true, + "isDomainable": false, + "isHealthScorable": true, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "regular", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "12375", + "className": "RsClientCertCA", + "classPkg": "comm", + "featureTag": "", + "moCategory": "RelationshipToLocal", + "label": "TP", + "properties": { + "annotation": { + "versions": "4.0(1h)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "42750", + "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 + }, + "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": "4.0(1h)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "42751", + "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 + }, + "forceResolve": { + "versions": "1.0(1e)-", + "comment": [ + "Whether the relation should force pull the target." + ], + "isConfigurable": false, + "propGlobalId": "107", + "propLocalId": "83", + "label": "Force Resolve", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "true", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "yes", + "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 + }, + "monPolDn": { + "versions": "4.0(1h)-", + "comment": [ + "The monitoring policy attached to this observable object." + ], + "isConfigurable": false, + "propGlobalId": "42745", + "propLocalId": "228", + "label": "Monitoring Policy", + "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 + }, + "rType": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the type of resolver." + ], + "isConfigurable": false, + "propGlobalId": "106", + "propLocalId": "82", + "label": "Resolver Type", + "baseType": "scalar:Enum8", + "modelType": "reln:ResolverType", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "mo", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "mo", + "platformFlavors": [ + + ], + "label": "MO "}, + { "value": "2", "localName": "service", + "platformFlavors": [ + + ], + "label": "Service "} + ], + "default": "mo", + "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 + }, + "state": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the state of the relationship." + ], + "isConfigurable": false, + "propGlobalId": "103", + "propLocalId": "26", + "label": "State", + "baseType": "scalar:Enum8", + "modelType": "reln:State", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "5", "localName": "cardinality-violation", + "platformFlavors": [ + + ], + "comment": [ + "cardinality violation - When relations are created such that\n they violate the cardinality, state of the relation would be\n set to this." + ], + "label": "Cardinality Violation "}, + { "value": "unformed", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "formed", + "platformFlavors": [ + + ], + "comment": [ + "the relationship is formed with the target object" + ], + "label": "Formed "}, + { "value": "4", "localName": "invalid-target", + "platformFlavors": [ + + ], + "comment": [ + "invalid target DN" + ], + "label": "Invalid Target "}, + { "value": "2", "localName": "missing-target", + "platformFlavors": [ + + ], + "comment": [ + "target does not exist" + ], + "label": "Missing Target "}, + { "value": "0", "localName": "unformed", + "platformFlavors": [ + + ], + "comment": [ + "the relationship is not formed" + ], + "label": "Unformed "} + ], + "default": "unformed", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "stateQual": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the state qualifier of the relationship." + ], + "isConfigurable": false, + "propGlobalId": "104", + "propLocalId": "80", + "label": "State Qualifier", + "baseType": "scalar:Enum8", + "modelType": "reln:StateQual", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "default-target", + "platformFlavors": [ + + ], + "comment": [ + "target not specified, using default" + ], + "label": "Target Not Specified "}, + { "value": "none", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "mismatch-target", + "platformFlavors": [ + + ], + "comment": [ + "target not found, using default" + ], + "label": "Target Not Found "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "comment": [ + "no issue" + ], + "label": "None "} + ], + "default": "none", + "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 + }, + "tCl": { + "versions": "4.0(1h)-", + "comment": [ + "The class ID of the target object. This property is managed internally and should not be modified by the user." + ], + "isConfigurable": false, + "propGlobalId": "42742", + "propLocalId": "78", + "label": "Target Class", + "baseType": "scalar:Enum16", + "modelType": "reln:ClassId", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validValues": [ + { "value": "1483", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1483", "localName": "pkiTP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "unspecified "} + ], + "default": "pkiTP", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "tDn": { + "versions": "4.0(1h)-", + "comment": [ + "The distinguished name of the target." + ], + "isConfigurable": true, + "propGlobalId": "50066", + "propLocalId": "77", + "label": "Target-dn", + "baseType": "reference:BinRef", + "modelType": "reln:Dn", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "tType": { + "versions": "1.0(1e)-", + "comment": [ + "The type of target." + ], + "isConfigurable": false, + "propGlobalId": "105", + "propLocalId": "81", + "label": "Target Type", + "baseType": "scalar:Enum8", + "modelType": "reln:TargetType", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "all", + "platformFlavors": [ + + ], + "label": "All "}, + { "value": "mo", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "mo", + "platformFlavors": [ + + ], + "label": "MO "}, + { "value": "0", "localName": "name", + "platformFlavors": [ + + ], + "label": "Name "} + ], + "default": "mo", + "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/commRsKeyRing.json b/gen/meta/commRsKeyRing.json new file mode 100644 index 000000000..8dd9b1e6b --- /dev/null +++ b/gen/meta/commRsKeyRing.json @@ -0,0 +1,1010 @@ +{ + "comm:RsKeyRing": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Counts": "", + "fault:Inst": "", + "health:Inst": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fault-": "fault:Inst", + "fltCnts": "fault:Counts", + "health": "health:Inst", + "rbacDom-": "aaa:RbacAnnotation", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + + ], + "rnFormat": "rsKeyRing", + "containedBy": { + "comm:Https": "" + }, + "superClasses": [ + "pol:NToRef", + "reln:To", + "reln:Inst" + ], + "subClasses": { + + }, + "relationInfo": { + "type": "named", + "cardinality": "n-to-1", + "fromMo": "comm:Https", + "fromRelMo": "comm:RsKeyRing", + "toMo": "pki:KeyRing", + "toRelMo": "pki:RtKeyRing", + "enforceable": true, + "resolvable": true + }, + "dnFormats": [ + "uni/fabric/comm-{name}/https/rsKeyRing" + ], + "writeAccess": [ + "aaa", + "admin" + ], + "readAccess": [ + "aaa", + "admin", + "fabric-equipment" + ], + "faults": { + "F1399": "fltCommRsKeyRingResolveFail" + }, + "events": { + "E4211228": "creation||comm:RsKeyRing", + "E4211229": "modification||comm:RsKeyRing", + "E4211230": "deletion||comm:RsKeyRing" + }, + "stats": { + + }, + "versions": "1.0(1e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": true, + "hasStats": false, + "isStat": false, + "isFaultable": true, + "isDomainable": false, + "isHealthScorable": true, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "regular", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "never", + "platformFlavors": [ + + ], + "classId": "5530", + "className": "RsKeyRing", + "classPkg": "comm", + "featureTag": "", + "moCategory": "RelationshipToLocal", + "label": "Key Ring", + "comment": [ + "A source relation to a key ring." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38117", + "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 + }, + "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": "40256", + "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 + }, + "forceResolve": { + "versions": "1.0(1e)-", + "comment": [ + "Whether the relation should force pull the target." + ], + "isConfigurable": false, + "propGlobalId": "107", + "propLocalId": "83", + "label": "Force Resolve", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "true", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "yes", + "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 + }, + "monPolDn": { + "versions": "1.0(1e)-", + "comment": [ + "The monitoring policy attached to this observable object." + ], + "isConfigurable": false, + "propGlobalId": "16229", + "propLocalId": "228", + "label": "Monitoring Policy", + "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 + }, + "rType": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the type of resolver." + ], + "isConfigurable": false, + "propGlobalId": "106", + "propLocalId": "82", + "label": "Resolver Type", + "baseType": "scalar:Enum8", + "modelType": "reln:ResolverType", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "mo", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "mo", + "platformFlavors": [ + + ], + "label": "MO "}, + { "value": "2", "localName": "service", + "platformFlavors": [ + + ], + "label": "Service "} + ], + "default": "mo", + "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 + }, + "state": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the state of the relationship." + ], + "isConfigurable": false, + "propGlobalId": "103", + "propLocalId": "26", + "label": "State", + "baseType": "scalar:Enum8", + "modelType": "reln:State", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "5", "localName": "cardinality-violation", + "platformFlavors": [ + + ], + "comment": [ + "cardinality violation - When relations are created such that\n they violate the cardinality, state of the relation would be\n set to this." + ], + "label": "Cardinality Violation "}, + { "value": "unformed", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "formed", + "platformFlavors": [ + + ], + "comment": [ + "the relationship is formed with the target object" + ], + "label": "Formed "}, + { "value": "4", "localName": "invalid-target", + "platformFlavors": [ + + ], + "comment": [ + "invalid target DN" + ], + "label": "Invalid Target "}, + { "value": "2", "localName": "missing-target", + "platformFlavors": [ + + ], + "comment": [ + "target does not exist" + ], + "label": "Missing Target "}, + { "value": "0", "localName": "unformed", + "platformFlavors": [ + + ], + "comment": [ + "the relationship is not formed" + ], + "label": "Unformed "} + ], + "default": "unformed", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "stateQual": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the state qualifier of the relationship." + ], + "isConfigurable": false, + "propGlobalId": "104", + "propLocalId": "80", + "label": "State Qualifier", + "baseType": "scalar:Enum8", + "modelType": "reln:StateQual", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "default-target", + "platformFlavors": [ + + ], + "comment": [ + "target not specified, using default" + ], + "label": "Target Not Specified "}, + { "value": "none", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "mismatch-target", + "platformFlavors": [ + + ], + "comment": [ + "target not found, using default" + ], + "label": "Target Not Found "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "comment": [ + "no issue" + ], + "label": "None "} + ], + "default": "none", + "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 + }, + "tCl": { + "versions": "1.0(1e)-", + "comment": [ + "The class ID of the target object. This property is managed internally and should not be modified by the user." + ], + "isConfigurable": false, + "propGlobalId": "16226", + "propLocalId": "78", + "label": "Target Class", + "baseType": "scalar:Enum16", + "modelType": "reln:ClassId", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validValues": [ + { "value": "1482", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1482", "localName": "pkiKeyRing", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "unspecified "} + ], + "default": "pkiKeyRing", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "tContextDn": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies the target context distinguished name." + ], + "isConfigurable": false, + "propGlobalId": "4990", + "propLocalId": "2530", + "label": "Target-context", + "baseType": "reference:BinRef", + "modelType": "reln:Dn", + "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 + }, + "tDn": { + "versions": "1.0(1e)-", + "comment": [ + "The distinguished name of the target." + ], + "isConfigurable": false, + "propGlobalId": "100", + "propLocalId": "77", + "label": "Target-dn", + "baseType": "reference:BinRef", + "modelType": "reln:Dn", + "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 + }, + "tRn": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies the target's related name." + ], + "isConfigurable": false, + "propGlobalId": "4989", + "propLocalId": "2529", + "label": "Target-rn", + "baseType": "string:Basic", + "modelType": "string:Basic", + "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 + }, + "tType": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the type of target. The target type for this object is named." + ], + "isConfigurable": false, + "propGlobalId": "4988", + "propLocalId": "81", + "label": "Target Type", + "baseType": "scalar:Enum8", + "modelType": "reln:TargetType", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "all", + "platformFlavors": [ + + ], + "label": "All "}, + { "value": "name", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "mo", + "platformFlavors": [ + + ], + "label": "MO "}, + { "value": "0", "localName": "name", + "platformFlavors": [ + + ], + "label": "Name "} + ], + "default": "name", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "tnPkiKeyRingName": { + "versions": "1.0(1e)-", + "comment": [ + "The HTTP connection key ring. Each PKI device holds a pair of asymmetric Rivest-Shamir-Adleman (RSA) or Elliptic Curve Cryptography (ECC) encryption keys, one kept private and one made public, stored in an internal key ring." + ], + "isConfigurable": true, + "propGlobalId": "16225", + "propLocalId": "3986", + "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": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "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/templates/resource.go.tmpl b/gen/templates/resource.go.tmpl index 82f5e95f8..cb206fd96 100644 --- a/gen/templates/resource.go.tmpl +++ b/gen/templates/resource.go.tmpl @@ -2,6 +2,68 @@ // 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). +{{- define "child_attributes" }} + "{{- .ResourceName}}": schema.SetNestedAttribute{ + MarkdownDescription: `{{.Comment}}`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + {{- if not .IdentifiedBy}} + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + {{- end}} + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + {{- range .Properties}} + {{- if eq .ValueType "bitmask"}} + "{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}": schema.SetAttribute{ + MarkdownDescription: `{{.Comment}}`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + {{- if .ValidValues}} + Validators: []validator.Set{ + setvalidator.SizeAtMost({{ len .ValidValues }}), + setvalidator.ValueStringsAre( + stringvalidator.OneOf({{- validatorString .ValidValues}}), + ), + }, + {{- end}} + ElementType: types.StringType, + }, + {{- else}} + "{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}": schema.StringAttribute{ + {{- if or .IsNaming .IsRequired}} + Required: true, + {{- else }} + Optional: true, + Computed: true, + {{- end}} + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + {{- if .ValidValues}} + Validators: []validator.String{ + stringvalidator.OneOf({{- validatorString .ValidValues}}), + }, + {{- end}} + MarkdownDescription: `{{.Comment}}`, + }, + {{- end}} + {{- end}} + {{- range .Children}} + {{- template "child_attributes" . }} + }, + }, + }, + {{- end}} + {{- end}} + package provider import ( @@ -74,9 +136,9 @@ type {{.ResourceClassName}}ResourceModel struct { {{- end}} } -{{- range .Children}} -// {{.ResourceClassName}}{{$.ResourceClassName}}ResourceModel describes the resource data model for the children without relation ships. -type {{.ResourceClassName}}{{$.ResourceClassName}}ResourceModel struct { +{{ define "child_structs" }} +// {{.ResourceClassName}}{{.ParentName}}ResourceModel describes the resource data model for the children without relation ships. +type {{.ResourceClassName}}{{.ParentName}}ResourceModel struct { {{- range .Properties}} {{- if eq .ValueType "bitmask"}} {{ .Name }} types.Set `tfsdk:"{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}"` @@ -86,9 +148,20 @@ type {{.ResourceClassName}}{{$.ResourceClassName}}ResourceModel struct { {{ .Name }} types.String `tfsdk:"{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}"` {{- end}} {{- end}} + {{- range .Children}} + {{ .ResourceClassName }} types.Set `tfsdk:"{{- .ResourceName}}"` + {{- end}} } +{{- range .Children}} +{{- template "child_structs" . }} +{{- end}} {{- end}} +{{- range .Children}} +{{- template "child_structs" . }} +{{- end}} + + {{if .IdentifiedBy}} type {{.ResourceClassName}}Identifier struct { {{- range .Properties}} @@ -175,64 +248,14 @@ func (r *{{.ResourceClassName}}Resource) Schema(ctx context.Context, req resourc {{- end}} {{- end}} {{- range .Children}} - "{{- .ResourceName}}": schema.SetNestedAttribute{ - MarkdownDescription: `{{.Comment}}`, - Optional: true, - Computed: true, - PlanModifiers: []planmodifier.Set{ - setplanmodifier.UseStateForUnknown(), - }, - {{- if not .IdentifiedBy}} - Validators: []validator.Set{ - setvalidator.SizeAtMost(1), - }, - {{- end}} - NestedObject: schema.NestedAttributeObject{ - Attributes: map[string]schema.Attribute{ - {{- range .Properties}} - {{- if eq .ValueType "bitmask"}} - "{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}": schema.SetAttribute{ - MarkdownDescription: `{{.Comment}}`, - Optional: true, - Computed: true, - PlanModifiers: []planmodifier.Set{ - setplanmodifier.UseStateForUnknown(), - }, - {{- if .ValidValues}} - Validators: []validator.Set{ - setvalidator.SizeAtMost({{ len .ValidValues }}), - setvalidator.ValueStringsAre( - stringvalidator.OneOf({{- validatorString .ValidValues}}), - ), - }, - {{- end}} - ElementType: types.StringType, - }, - {{- else}} - "{{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}": schema.StringAttribute{ - {{- if or .IsNaming .IsRequired}} - Required: true, - {{- else }} - Optional: true, - Computed: true, - {{- end}} - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, - {{- if .ValidValues}} - Validators: []validator.String{ - stringvalidator.OneOf({{- validatorString .ValidValues}}), - }, - {{- end}} - MarkdownDescription: `{{.Comment}}`, - }, - {{- end}} + {{- template "child_attributes" . }} + + }, + }, + }, + {{- end}} }, - }, - }, - {{- end}} - }, } tflog.Debug(ctx, "End schema of resource: aci_{{.ResourceName}}") } @@ -284,7 +307,7 @@ func (r *{{.ResourceClassName}}Resource) Create(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_{{.ResourceName}} with id '%s'", data.Id.ValueString())) {{ if .HasChild}} - {{- range .Children}} + {{- range .Children}} var {{.PkgName}}Plan, {{.PkgName}}State []{{.ResourceClassName}}{{$.ResourceClassName}}ResourceModel data.{{ .ResourceClassName }}.ElementsAs(ctx, &{{.PkgName}}Plan, false) stateData.{{ .ResourceClassName }}.ElementsAs(ctx, &{{.PkgName}}State, false) @@ -302,7 +325,8 @@ func (r *{{.ResourceClassName}}Resource) Create(ctx context.Context, req resourc if resp.Diagnostics.HasError() { return } - + + getAndSet{{.ResourceClassName}}Attributes(ctx, &resp.Diagnostics, r.client, data) // Save data into Terraform state @@ -355,6 +379,8 @@ func (r *{{.ResourceClassName}}Resource) Update(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_{{.ResourceName}} with id '%s'", data.Id.ValueString())) + + {{ if .HasChild}} {{- range .Children}} var {{.PkgName}}Plan, {{.PkgName}}State []{{.ResourceClassName}}{{$.ResourceClassName}}ResourceModel @@ -371,7 +397,7 @@ func (r *{{.ResourceClassName}}Resource) Update(ctx context.Context, req resourc } DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) - + if resp.Diagnostics.HasError() { return } @@ -612,6 +638,7 @@ func set{{.ResourceClassName}}Id(ctx context.Context, data *{{.ResourceClassName {{- end}} } + {{ range .Children}} func get{{$.ResourceClassName}}{{ .ResourceClassName }}ChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *{{$.ResourceClassName}}ResourceModel, {{.PkgName}}Plan, {{.PkgName}}State []{{.ResourceClassName}}{{$.ResourceClassName}}ResourceModel) []map[string]interface{} { diff --git a/gen/testvars/commPol.yaml b/gen/testvars/commPol.yaml new file mode 100644 index 000000000..5258c8938 --- /dev/null +++ b/gen/testvars/commPol.yaml @@ -0,0 +1,84 @@ +# 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_alias: "" + owner_key: "" + owner_tag: "" + strict_security_on_apic_oob_subnet: "false" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + annotation: "annotation" + description: "description" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + strict_security_on_apic_oob_subnet: "no" + +children: + http_ssl_configuration: + - access_control_allow_credential: "disabled" + access_control_allow_origins: "access_control_allow_origins_1" + admin_st: "disabled" + annotation: "annotation_1" + cli_only_mode: "disabled" + client_cert_auth_state: "disabled" + description: "description_1" + dh_param: "1024" + global_throttle_rate: "global_throttle_rate_1" + global_throttle_st: "disabled" + global_throttle_unit: "global_throttle_unit_1" + max_request_status_count: "max_request_status_count_1" + name: "name_1" + name_alias: "name_alias_1" + node_exporter: "disabled" + port: "port_1" + referer: "referer_1" + server_header: "disabled" + ssl_protocols: "TLSv1" + throttle_rate: "throttle_rate_1" + throttle_st: "disabled" + visore_access: "disabled" + + - access_control_allow_credential: "enabled" + access_control_allow_origins: "access_control_allow_origins_2" + admin_st: "enabled" + annotation: "annotation_2" + cli_only_mode: "enabled" + client_cert_auth_state: "enabled" + description: "description_2" + dh_param: "2048" + global_throttle_rate: "global_throttle_rate_2" + global_throttle_st: "enabled" + global_throttle_unit: "global_throttle_unit_2" + max_request_status_count: "max_request_status_count_2" + name: "name_2" + name_alias: "name_alias_2" + node_exporter: "enabled" + port: "port_2" + referer: "referer_2" + server_header: "enabled" + ssl_protocols: "TLSv1.1" + throttle_rate: "throttle_rate_2" + throttle_st: "enabled" + visore_access: "enabled" + + annotations: + - key: "annotations_1" + value: "value_1" + + - key: "annotations_2" + value: "value_2" + diff --git a/internal/provider/data_source_aci_communication_policy.go b/internal/provider/data_source_aci_communication_policy.go new file mode 100644 index 000000000..8c851878a --- /dev/null +++ b/internal/provider/data_source_aci_communication_policy.go @@ -0,0 +1,247 @@ +// 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-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &CommPolDataSource{} + +func NewCommPolDataSource() datasource.DataSource { + return &CommPolDataSource{} +} + +// CommPolDataSource defines the data source implementation. +type CommPolDataSource struct { + client *client.Client +} + +func (d *CommPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_communication_policy") + resp.TypeName = req.ProviderTypeName + "_communication_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_communication_policy") +} + +func (d *CommPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_communication_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The communication_policy datasource for the 'commPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Communication Policy object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Communication Policy object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Communication Policy object.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Communication Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Communication Policy 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.`, + }, + "strict_security_on_apic_oob_subnet": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `remove implicit access on apic oob from any apic OOB subnet IP.`, + }, + "http_ssl_configuration": schema.SetNestedAttribute{ + MarkdownDescription: `HTTPS`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "access_control_allow_credential": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `accessControlAllowCredential.`, + }, + "access_control_allow_origins": schema.StringAttribute{ + Computed: true, + MarkdownDescription: ``, + }, + "admin_st": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The state of HTTPS communication service. This can be enabled or disabled.`, + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Http Ssl Configuration object.`, + }, + "cli_only_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `CLI only mode.`, + }, + "client_cert_auth_state": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Client Cert Auth State.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Http Ssl Configuration object.`, + }, + "dh_param": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `DH Parameter.`, + }, + "global_throttle_rate": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The maximum MO api calls allowed per unit time.`, + }, + "global_throttle_st": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Throttle state for all clients without tag0 in header.`, + }, + "global_throttle_unit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Unit of rate limit.`, + }, + "max_request_status_count": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The maximum number of request status objects to keep.`, + }, + "name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Http Ssl Configuration object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Http Ssl Configuration object.`, + }, + "node_exporter": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Node Exporter service.`, + }, + "port": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The port used for HTTPS communication service.`, + }, + "referer": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Allowed HTTP referer space separated list.`, + }, + "server_header": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Server Header.`, + }, + "ssl_protocols": schema.SetAttribute{ + Computed: true, + MarkdownDescription: `The Secure Socket Layer (SSL) protocol.`, + ElementType: types.StringType, + }, + "throttle_rate": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The maximum login/refresh allowed per second.`, + }, + "throttle_st": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Login/refresh throttle state.`, + }, + "visore_access": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Visore Access.`, + }, + }, + }, + }, + "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.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_communication_policy") +} + +func (d *CommPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_communication_policy") + // 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_communication_policy") +} + +func (d *CommPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_communication_policy") + var data *CommPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setCommPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetCommPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_communication_policy with id '%s'", data.Id.ValueString())) + + getAndSetCommPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_communication_policy data source", + fmt.Sprintf("The aci_communication_policy 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_communication_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_communication_policy_test.go b/internal/provider/data_source_aci_communication_policy_test.go new file mode 100644 index 000000000..fb8a6a807 --- /dev/null +++ b/internal/provider/data_source_aci_communication_policy_test.go @@ -0,0 +1,51 @@ +// 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 TestAccDataSourceCommPol(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigCommPolDataSource, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_communication_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("data.aci_communication_policy.test", "description", "description"), + resource.TestCheckResourceAttr("data.aci_communication_policy.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("data.aci_communication_policy.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("data.aci_communication_policy.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("data.aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "no"), + ), + }, + { + Config: testConfigCommPolNotExisting, + ExpectError: regexp.MustCompile("Failed to read aci_communication_policy data source"), + }, + }, + }) +} + +const testConfigCommPolDataSource = testConfigCommPolAll + ` +data "aci_communication_policy" "test" { + name = "test_name" + depends_on = [aci_communication_policy.test] +} +` + +const testConfigCommPolNotExisting = testConfigCommPolAll + ` +data "aci_communication_policy" "test" { + name = "non_existing_name" + depends_on = [aci_communication_policy.test] +} +` diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 28585b501..d9681521f 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -196,6 +196,7 @@ func (p *AciProvider) Configure(ctx context.Context, req provider.ConfigureReque func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource { return []func() resource.Resource{ + NewCommPolResource, NewFvEpIpTagResource, NewFvEpMacTagResource, NewL3extConsLblResource, @@ -213,6 +214,7 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataSource { return []func() datasource.DataSource{ + NewCommPolDataSource, NewFvEpIpTagDataSource, NewFvEpMacTagDataSource, NewL3extConsLblDataSource, diff --git a/internal/provider/resource_aci_communication_policy.go b/internal/provider/resource_aci_communication_policy.go new file mode 100644 index 000000000..e9b0284d8 --- /dev/null +++ b/internal/provider/resource_aci_communication_policy.go @@ -0,0 +1,1036 @@ +// 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/setvalidator" + "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 = &CommPolResource{} +var _ resource.ResourceWithImportState = &CommPolResource{} + +func NewCommPolResource() resource.Resource { + return &CommPolResource{} +} + +// CommPolResource defines the resource implementation. +type CommPolResource struct { + client *client.Client +} + +// CommPolResourceModel describes the resource data model. +type CommPolResourceModel struct { + Id types.String `tfsdk:"id"` + 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"` + StrictSecurityOnApicOOBSubnet types.String `tfsdk:"strict_security_on_apic_oob_subnet"` + CommHttps types.Set `tfsdk:"http_ssl_configuration"` + TagAnnotation types.Set `tfsdk:"annotations"` +} + +// CommHttpsCommPolResourceModel describes the resource data model for the children without relation ships. +type CommHttpsCommPolResourceModel struct { + AccessControlAllowCredential types.String `tfsdk:"access_control_allow_credential"` + AccessControlAllowOrigins types.String `tfsdk:"access_control_allow_origins"` + AdminSt types.String `tfsdk:"admin_st"` + Annotation types.String `tfsdk:"annotation"` + CliOnlyMode types.String `tfsdk:"cli_only_mode"` + ClientCertAuthState types.String `tfsdk:"client_cert_auth_state"` + Descr types.String `tfsdk:"description"` + DhParam types.String `tfsdk:"dh_param"` + GlobalThrottleRate types.String `tfsdk:"global_throttle_rate"` + GlobalThrottleSt types.String `tfsdk:"global_throttle_st"` + GlobalThrottleUnit types.String `tfsdk:"global_throttle_unit"` + MaxRequestStatusCount types.String `tfsdk:"max_request_status_count"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + NodeExporter types.String `tfsdk:"node_exporter"` + Port types.String `tfsdk:"port"` + Referer types.String `tfsdk:"referer"` + ServerHeader types.String `tfsdk:"server_header"` + SslProtocols types.Set `tfsdk:"ssl_protocols"` + ThrottleRate types.String `tfsdk:"throttle_rate"` + ThrottleSt types.String `tfsdk:"throttle_st"` + VisoreAccess types.String `tfsdk:"visore_access"` + CommRsClientCertCA types.Set `tfsdk:"tp"` + CommRsKeyRing types.Set `tfsdk:"key_ring"` +} + +// CommRsClientCertCACommHttpsResourceModel describes the resource data model for the children without relation ships. +type CommRsClientCertCACommHttpsResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TDn types.String `tfsdk:"target_dn"` +} + +// CommRsKeyRingCommHttpsResourceModel describes the resource data model for the children without relation ships. +type CommRsKeyRingCommHttpsResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnPkiKeyRingName types.String `tfsdk:"tn_pki_key_ring_name"` +} + +// TagAnnotationCommPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationCommPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type CommPolIdentifier struct { + Name types.String +} + +func (r *CommPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_communication_policy") + resp.TypeName = req.ProviderTypeName + "_communication_policy" + tflog.Debug(ctx, "End metadata of resource: aci_communication_policy") +} + +func (r *CommPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_communication_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The communication_policy resource for the 'commPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Communication Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Communication Policy object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Communication Policy object.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Communication Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Communication Policy 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.`, + }, + "strict_security_on_apic_oob_subnet": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `remove implicit access on apic oob from any apic OOB subnet IP.`, + }, + "http_ssl_configuration": schema.SetNestedAttribute{ + MarkdownDescription: `HTTPS`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "access_control_allow_credential": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `accessControlAllowCredential.`, + }, + "access_control_allow_origins": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: ``, + }, + "admin_st": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `The state of HTTPS communication service. This can be enabled or disabled.`, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Http Ssl Configuration object.`, + }, + "cli_only_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `CLI only mode.`, + }, + "client_cert_auth_state": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Client Cert Auth State.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Http Ssl Configuration object.`, + }, + "dh_param": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("1024", "2048", "4096", "none"), + }, + MarkdownDescription: `DH Parameter.`, + }, + "global_throttle_rate": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The maximum MO api calls allowed per unit time.`, + }, + "global_throttle_st": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Throttle state for all clients without tag0 in header.`, + }, + "global_throttle_unit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Unit of rate limit.`, + }, + "max_request_status_count": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The maximum number of request status objects to keep.`, + }, + "name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Http Ssl Configuration object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Http Ssl Configuration object.`, + }, + "node_exporter": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Node Exporter service.`, + }, + "port": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The port used for HTTPS communication service.`, + }, + "referer": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Allowed HTTP referer space separated list.`, + }, + "server_header": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Server Header.`, + }, + "ssl_protocols": schema.SetAttribute{ + MarkdownDescription: `The Secure Socket Layer (SSL) protocol.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(4), + setvalidator.ValueStringsAre( + stringvalidator.OneOf("TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"), + ), + }, + ElementType: types.StringType, + }, + "throttle_rate": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The maximum login/refresh allowed per second.`, + }, + "throttle_st": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Login/refresh throttle state.`, + }, + "visore_access": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Visore Access.`, + }, + "tp": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Tp object.`, + }, + "target_dn": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The distinguished name of the target.`, + }, + }, + }, + }, + "key_ring": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to a key ring.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Key Ring object.`, + }, + "tn_pki_key_ring_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The HTTP connection key ring. Each PKI device holds a pair of asymmetric Rivest-Shamir-Adleman (RSA) or Elliptic Curve Cryptography (ECC) encryption keys, one kept private and one made public, stored in an internal key ring.`, + }, + }, + }, + }, + }, + }, + }, + "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.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_communication_policy") +} + +func (r *CommPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_communication_policy") + // 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_communication_policy") +} + +func (r *CommPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_communication_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *CommPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setCommPolId(ctx, stateData) + getAndSetCommPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *CommPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setCommPolId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_communication_policy with id '%s'", data.Id.ValueString())) + + var commHttpsPlan, commHttpsState []CommHttpsCommPolResourceModel + data.CommHttps.ElementsAs(ctx, &commHttpsPlan, false) + stateData.CommHttps.ElementsAs(ctx, &commHttpsState, false) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationCommPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + jsonPayload := getCommPolCreateJsonPayload(ctx, &resp.Diagnostics, data, commHttpsPlan, commHttpsState, tagAnnotationPlan, tagAnnotationState) + + 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 + } + + getAndSetCommPolAttributes(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_communication_policy with id '%s'", data.Id.ValueString())) +} + +func (r *CommPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_communication_policy") + var data *CommPolResourceModel + + // 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_communication_policy with id '%s'", data.Id.ValueString())) + + getAndSetCommPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *CommPolResourceModel + 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_communication_policy with id '%s'", data.Id.ValueString())) +} + +func (r *CommPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_communication_policy") + var data *CommPolResourceModel + var stateData *CommPolResourceModel + + // 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_communication_policy with id '%s'", data.Id.ValueString())) + + var commHttpsPlan, commHttpsState []CommHttpsCommPolResourceModel + data.CommHttps.ElementsAs(ctx, &commHttpsPlan, false) + stateData.CommHttps.ElementsAs(ctx, &commHttpsState, false) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationCommPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + jsonPayload := getCommPolCreateJsonPayload(ctx, &resp.Diagnostics, data, commHttpsPlan, commHttpsState, tagAnnotationPlan, tagAnnotationState) + + 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 + } + + getAndSetCommPolAttributes(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_communication_policy with id '%s'", data.Id.ValueString())) +} + +func (r *CommPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_communication_policy") + var data *CommPolResourceModel + + // 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_communication_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "commPol", 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_communication_policy with id '%s'", data.Id.ValueString())) +} + +func (r *CommPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_communication_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *CommPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_communication_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_communication_policy") +} + +func getAndSetCommPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *CommPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "commPol,commHttps,tagAnnotation"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("commPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("commPol").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)) + } + 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 == "strictSecurityOnApicOOBSubnet" { + data.StrictSecurityOnApicOOBSubnet = basetypes.NewStringValue(attributeValue.(string)) + } + } + CommHttpsCommPolList := make([]CommHttpsCommPolResourceModel, 1) + TagAnnotationCommPolList := make([]TagAnnotationCommPolResourceModel, 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 == "commHttps" { + CommHttpsCommPol := CommHttpsCommPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "accessControlAllowCredential" { + CommHttpsCommPol.AccessControlAllowCredential = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "accessControlAllowOrigins" { + CommHttpsCommPol.AccessControlAllowOrigins = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "adminSt" { + CommHttpsCommPol.AdminSt = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "annotation" { + CommHttpsCommPol.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "cliOnlyMode" { + CommHttpsCommPol.CliOnlyMode = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "clientCertAuthState" { + CommHttpsCommPol.ClientCertAuthState = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "descr" { + CommHttpsCommPol.Descr = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "dhParam" && childAttributeValue.(string) == "" { + CommHttpsCommPol.DhParam = basetypes.NewStringValue("none") + } else if childAttributeName == "dhParam" { + CommHttpsCommPol.DhParam = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "globalThrottleRate" { + CommHttpsCommPol.GlobalThrottleRate = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "globalThrottleSt" { + CommHttpsCommPol.GlobalThrottleSt = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "globalThrottleUnit" { + CommHttpsCommPol.GlobalThrottleUnit = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "maxRequestStatusCount" { + CommHttpsCommPol.MaxRequestStatusCount = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "name" { + CommHttpsCommPol.Name = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "nameAlias" { + CommHttpsCommPol.NameAlias = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "nodeExporter" { + CommHttpsCommPol.NodeExporter = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "port" { + CommHttpsCommPol.Port = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "referer" { + CommHttpsCommPol.Referer = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "serverHeader" { + CommHttpsCommPol.ServerHeader = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "sslProtocols" { + sslProtocolsList := strings.Split(childAttributeValue.(string), ",") + sslProtocolsSet, _ := types.SetValueFrom(ctx, CommHttpsCommPol.SslProtocols.ElementType(ctx), sslProtocolsList) + CommHttpsCommPol.SslProtocols = sslProtocolsSet + } + if childAttributeName == "throttleRate" { + CommHttpsCommPol.ThrottleRate = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "throttleSt" { + CommHttpsCommPol.ThrottleSt = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "visoreAccess" { + CommHttpsCommPol.VisoreAccess = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + CommHttpsCommPolList[0] = CommHttpsCommPol + } + if childClassName == "tagAnnotation" { + TagAnnotationCommPol := TagAnnotationCommPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationCommPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationCommPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationCommPolList = append(TagAnnotationCommPolList, TagAnnotationCommPol) + } + } + } + } + if len(CommHttpsCommPolList) > 0 { + commHttpsSet, _ := types.SetValueFrom(ctx, data.CommHttps.ElementType(ctx), CommHttpsCommPolList) + data.CommHttps = commHttpsSet + } + if len(TagAnnotationCommPolList) > 0 { + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationCommPolList) + data.TagAnnotation = tagAnnotationSet + } + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'commPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getCommPolRn(ctx context.Context, data *CommPolResourceModel) string { + rn := "comm-{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 setCommPolId(ctx context.Context, data *CommPolResourceModel) { + rn := getCommPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", strings.Split([]string{"uni/fabric/comm-{name}"}[0], "/")[0], rn)) +} + +func getCommPolCommHttpsChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *CommPolResourceModel, commHttpsPlan, commHttpsState []CommHttpsCommPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.CommHttps.IsUnknown() { + for _, commHttps := range commHttpsPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !commHttps.AccessControlAllowCredential.IsUnknown() { + childMap["attributes"]["accessControlAllowCredential"] = commHttps.AccessControlAllowCredential.ValueString() + } + if !commHttps.AccessControlAllowOrigins.IsUnknown() { + childMap["attributes"]["accessControlAllowOrigins"] = commHttps.AccessControlAllowOrigins.ValueString() + } + if !commHttps.AdminSt.IsUnknown() { + childMap["attributes"]["adminSt"] = commHttps.AdminSt.ValueString() + } + if !commHttps.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = commHttps.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !commHttps.CliOnlyMode.IsUnknown() { + childMap["attributes"]["cliOnlyMode"] = commHttps.CliOnlyMode.ValueString() + } + if !commHttps.ClientCertAuthState.IsUnknown() { + childMap["attributes"]["clientCertAuthState"] = commHttps.ClientCertAuthState.ValueString() + } + if !commHttps.Descr.IsUnknown() { + childMap["attributes"]["descr"] = commHttps.Descr.ValueString() + } + if !commHttps.DhParam.IsUnknown() { + childMap["attributes"]["dhParam"] = commHttps.DhParam.ValueString() + } + if !commHttps.GlobalThrottleRate.IsUnknown() { + childMap["attributes"]["globalThrottleRate"] = commHttps.GlobalThrottleRate.ValueString() + } + if !commHttps.GlobalThrottleSt.IsUnknown() { + childMap["attributes"]["globalThrottleSt"] = commHttps.GlobalThrottleSt.ValueString() + } + if !commHttps.GlobalThrottleUnit.IsUnknown() { + childMap["attributes"]["globalThrottleUnit"] = commHttps.GlobalThrottleUnit.ValueString() + } + if !commHttps.MaxRequestStatusCount.IsUnknown() { + childMap["attributes"]["maxRequestStatusCount"] = commHttps.MaxRequestStatusCount.ValueString() + } + if !commHttps.Name.IsUnknown() { + childMap["attributes"]["name"] = commHttps.Name.ValueString() + } + if !commHttps.NameAlias.IsUnknown() { + childMap["attributes"]["nameAlias"] = commHttps.NameAlias.ValueString() + } + if !commHttps.NodeExporter.IsUnknown() { + childMap["attributes"]["nodeExporter"] = commHttps.NodeExporter.ValueString() + } + if !commHttps.Port.IsUnknown() { + childMap["attributes"]["port"] = commHttps.Port.ValueString() + } + if !commHttps.Referer.IsUnknown() { + childMap["attributes"]["referer"] = commHttps.Referer.ValueString() + } + if !commHttps.ServerHeader.IsUnknown() { + childMap["attributes"]["serverHeader"] = commHttps.ServerHeader.ValueString() + } + if !commHttps.SslProtocols.IsUnknown() { + var tmpSslProtocols []string + commHttps.SslProtocols.ElementsAs(ctx, &tmpSslProtocols, false) + childMap["attributes"]["sslProtocols"] = strings.Join(tmpSslProtocols, ",") + } + if !commHttps.ThrottleRate.IsUnknown() { + childMap["attributes"]["throttleRate"] = commHttps.ThrottleRate.ValueString() + } + if !commHttps.ThrottleSt.IsUnknown() { + childMap["attributes"]["throttleSt"] = commHttps.ThrottleSt.ValueString() + } + if !commHttps.VisoreAccess.IsUnknown() { + childMap["attributes"]["visoreAccess"] = commHttps.VisoreAccess.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"commHttps": childMap}) + } + if len(commHttpsPlan) == 0 && len(commHttpsState) == 1 { + diags.AddError( + "CommHttps object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + return nil + } + } else { + data.CommHttps = types.SetNull(data.CommHttps.ElementType(ctx)) + } + + return childPayloads +} +func getCommPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *CommPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationCommPolResourceModel) []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 getCommPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *CommPolResourceModel, commHttpsPlan, commHttpsState []CommHttpsCommPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationCommPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + CommHttpschildPayloads := getCommPolCommHttpsChildPayloads(ctx, diags, data, commHttpsPlan, commHttpsState) + if CommHttpschildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, CommHttpschildPayloads...) + + TagAnnotationchildPayloads := getCommPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + 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.StrictSecurityOnApicOOBSubnet.IsNull() && !data.StrictSecurityOnApicOOBSubnet.IsUnknown() { + payloadMap["attributes"].(map[string]string)["strictSecurityOnApicOOBSubnet"] = data.StrictSecurityOnApicOOBSubnet.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"commPol": 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_communication_policy_test.go b/internal/provider/resource_aci_communication_policy_test.go new file mode 100644 index 000000000..9acbce50d --- /dev/null +++ b/internal/provider/resource_aci_communication_policy_test.go @@ -0,0 +1,411 @@ +// 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 TestAccResourceCommPol(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: testConfigCommPolMin, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "false"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigCommPolAll, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", "description"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "no"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigCommPolMin, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", "description"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "no"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigCommPolReset, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "false"), + ), + }, + // Import testing + { + ResourceName: "aci_communication_policy.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "false"), + ), + }, + // Update with children + { + Config: testConfigCommPolChildren, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "false"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.0.key", "annotations_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.1.key", "annotations_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.access_control_allow_credential", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.access_control_allow_origins", "access_control_allow_origins_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.cli_only_mode", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.client_cert_auth_state", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.dh_param", "1024"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_rate", "global_throttle_rate_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_st", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_unit", "global_throttle_unit_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.max_request_status_count", "max_request_status_count_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.name", "name_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.node_exporter", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.port", "port_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.referer", "referer_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.server_header", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.ssl_protocols", "TLSv1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.throttle_rate", "throttle_rate_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.throttle_st", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.visore_access", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.access_control_allow_credential", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.access_control_allow_origins", "access_control_allow_origins_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.admin_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.cli_only_mode", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.client_cert_auth_state", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.dh_param", "2048"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.global_throttle_rate", "global_throttle_rate_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.global_throttle_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.global_throttle_unit", "global_throttle_unit_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.max_request_status_count", "max_request_status_count_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.name", "name_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.name_alias", "name_alias_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.node_exporter", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.port", "port_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.referer", "referer_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.server_header", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.ssl_protocols", "TLSv1.1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.throttle_rate", "throttle_rate_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.throttle_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.visore_access", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.#", "2"), + ), + }, + // Update with children removed from config + { + Config: testConfigCommPolChildrenRemoveFromConfig, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "false"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.0.key", "annotations_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.1.key", "annotations_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.access_control_allow_credential", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.access_control_allow_origins", "access_control_allow_origins_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.cli_only_mode", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.client_cert_auth_state", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.dh_param", "1024"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_rate", "global_throttle_rate_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_st", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_unit", "global_throttle_unit_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.max_request_status_count", "max_request_status_count_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.name", "name_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.node_exporter", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.port", "port_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.referer", "referer_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.server_header", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.ssl_protocols", "TLSv1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.throttle_rate", "throttle_rate_1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.throttle_st", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.visore_access", "disabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.access_control_allow_credential", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.access_control_allow_origins", "access_control_allow_origins_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.admin_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.cli_only_mode", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.client_cert_auth_state", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.dh_param", "2048"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.global_throttle_rate", "global_throttle_rate_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.global_throttle_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.global_throttle_unit", "global_throttle_unit_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.max_request_status_count", "max_request_status_count_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.name", "name_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.name_alias", "name_alias_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.node_exporter", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.port", "port_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.referer", "referer_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.server_header", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.ssl_protocols", "TLSv1.1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.throttle_rate", "throttle_rate_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.throttle_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.1.visore_access", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigCommPolChildrenRemoveOne, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "false"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.0.key", "annotations_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.access_control_allow_credential", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.access_control_allow_origins", "access_control_allow_origins_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.admin_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.cli_only_mode", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.client_cert_auth_state", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.description", "description_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.dh_param", "2048"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_rate", "global_throttle_rate_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.global_throttle_unit", "global_throttle_unit_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.max_request_status_count", "max_request_status_count_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.name", "name_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.name_alias", "name_alias_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.node_exporter", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.port", "port_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.referer", "referer_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.server_header", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.ssl_protocols", "TLSv1.1"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.throttle_rate", "throttle_rate_2"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.throttle_st", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.0.visore_access", "enabled"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigCommPolChildrenRemoveAll, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_communication_policy.test", "strict_security_on_apic_oob_subnet", "false"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_communication_policy.test", "http_ssl_configuration.#", "0"), + ), + }, + }, + }) +} + +const testConfigCommPolMin = ` +resource "aci_communication_policy" "test" { + name = "test_name" +} +` + +const testConfigCommPolAll = ` +resource "aci_communication_policy" "test" { + name = "test_name" + annotation = "annotation" + description = "description" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + strict_security_on_apic_oob_subnet = "no" +} +` + +const testConfigCommPolReset = ` +resource "aci_communication_policy" "test" { + name = "test_name" + annotation = "orchestrator:terraform" + description = "" + name_alias = "" + owner_key = "" + owner_tag = "" + strict_security_on_apic_oob_subnet = "false" +} +` +const testConfigCommPolChildren = ` +resource "aci_communication_policy" "test" { + name = "test_name" + annotations = [ + { + key = "annotations_1" + value = "value_1" + }, + { + key = "annotations_2" + value = "value_2" + }, + ] + http_ssl_configuration = [ + { + access_control_allow_credential = "disabled" + access_control_allow_origins = "access_control_allow_origins_1" + admin_st = "disabled" + annotation = "annotation_1" + cli_only_mode = "disabled" + client_cert_auth_state = "disabled" + description = "description_1" + dh_param = "1024" + global_throttle_rate = "global_throttle_rate_1" + global_throttle_st = "disabled" + global_throttle_unit = "global_throttle_unit_1" + max_request_status_count = "max_request_status_count_1" + name = "name_1" + name_alias = "name_alias_1" + node_exporter = "disabled" + port = "port_1" + referer = "referer_1" + server_header = "disabled" + ssl_protocols = "TLSv1" + throttle_rate = "throttle_rate_1" + throttle_st = "disabled" + visore_access = "disabled" + }, + { + access_control_allow_credential = "enabled" + access_control_allow_origins = "access_control_allow_origins_2" + admin_st = "enabled" + annotation = "annotation_2" + cli_only_mode = "enabled" + client_cert_auth_state = "enabled" + description = "description_2" + dh_param = "2048" + global_throttle_rate = "global_throttle_rate_2" + global_throttle_st = "enabled" + global_throttle_unit = "global_throttle_unit_2" + max_request_status_count = "max_request_status_count_2" + name = "name_2" + name_alias = "name_alias_2" + node_exporter = "enabled" + port = "port_2" + referer = "referer_2" + server_header = "enabled" + ssl_protocols = "TLSv1.1" + throttle_rate = "throttle_rate_2" + throttle_st = "enabled" + visore_access = "enabled" + }, + ] +} +` + +const testConfigCommPolChildrenRemoveFromConfig = ` +resource "aci_communication_policy" "test" { + name = "test_name" +} +` + +const testConfigCommPolChildrenRemoveOne = ` +resource "aci_communication_policy" "test" { + name = "test_name" + annotations = [ + { + key = "annotations_2" + value = "value_2" + }, + ] + http_ssl_configuration = [ + { + access_control_allow_credential = "enabled" + access_control_allow_origins = "access_control_allow_origins_2" + admin_st = "enabled" + annotation = "annotation_2" + cli_only_mode = "enabled" + client_cert_auth_state = "enabled" + description = "description_2" + dh_param = "2048" + global_throttle_rate = "global_throttle_rate_2" + global_throttle_st = "enabled" + global_throttle_unit = "global_throttle_unit_2" + max_request_status_count = "max_request_status_count_2" + name = "name_2" + name_alias = "name_alias_2" + node_exporter = "enabled" + port = "port_2" + referer = "referer_2" + server_header = "enabled" + ssl_protocols = "TLSv1.1" + throttle_rate = "throttle_rate_2" + throttle_st = "enabled" + visore_access = "enabled" + }, + ] +} +` + +const testConfigCommPolChildrenRemoveAll = ` +resource "aci_communication_policy" "test" { + name = "test_name" + annotations = [] + http_ssl_configuration = [] +} +`