Skip to content

Commit

Permalink
[minor_change] Add Resource and Datasource for Netflow Exporter Polic…
Browse files Browse the repository at this point in the history
…y (netflowExporterPol).
  • Loading branch information
gmicol committed Jun 26, 2024
1 parent 2d8ffe2 commit 7fa6460
Show file tree
Hide file tree
Showing 19 changed files with 2,936 additions and 10 deletions.
76 changes: 76 additions & 0 deletions docs/data-sources/netflow_exporter_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
# Documentation generated by "gen/generator.go"; DO NOT EDIT.
# In order to regenerate this file execute `go generate` from the repository root.
# More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md).
subcategory: "Tenant Policies"
layout: "aci"
page_title: "ACI: aci_netflow_exporter_policy"
sidebar_current: "docs-aci-data-source-aci_netflow_exporter_policy"
description: |-
Data source for Netflow Exporter Policy
---

# aci_netflow_exporter_policy #

Data source for Netflow Exporter Policy

## API Information ##

* Class: [netflowExporterPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowExporterPol/overview)

* Supported in ACI versions: 2.2(1k) and later.

* Distinguished Name Formats:
- `uni/infra/exporterpol-{name}`
- `uni/tn-{name}/exporterpol-{name}`

## GUI Information ##

* Locations:
- `Tenants -> Policies -> NetFlow -> NetFlow Exporters`
- `Fabric -> Access Policies -> Policies -> Interface -> NetFlow -> NetFlow Exporters`

## Example Usage ##

```hcl
data "aci_netflow_exporter_policy" "example_tenant" {
parent_dn = aci_tenant.example.id
name = "netfow_exporter"
}
```

## Schema ##

### Required ###

* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
- [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview))
- The distinguished name (DN) of classes below can be used but currently there is no available resource for it:
- [infraInfra](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/infraInfra/overview)

* `name` (name) - (string) The name of the Netflow Exporter Policy object.

### Read-Only ###

* `id` - (string) The distinguished name (DN) of the Netflow Exporter Policy object.
* `annotation` (annotation) - (string) The annotation of the Netflow Exporter Policy object.
* `description` (descr) - (string) The description of the Netflow Exporter Policy object.
* `dscp` (dscp) - (string) IP dscp value.
* `dst_addr` (dstAddr) - (string) Remote node destination IP address.
* `dst_port` (dstPort) - (string) Remote node destination port.
* `name_alias` (nameAlias) - (string) The name alias of the Netflow Exporter 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.
* `source_ip_type` (sourceIpType) - (string) Type of Exporter Src IP Address: Can be one of the available management IP Address for a given leaf or a custom IP Address.
* `src_addr` (srcAddr) - (string) Source IP address.
* `ver` (ver) - (string) Collector version.

* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later.
* `key` (key) - (string) The key used to uniquely identify this configuration object.
* `value` (value) - (string) The value of the property.

* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). This attribute is supported in ACI versions: 3.2(1l) and later.
* `key` (key) - (string) The key used to uniquely identify this configuration object.
* `value` (value) - (string) The value of the property.
153 changes: 153 additions & 0 deletions docs/resources/netflow_exporter_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
---
# 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: "Tenant Policies"
layout: "aci"
page_title: "ACI: aci_netflow_exporter_policy"
sidebar_current: "docs-aci-resource-aci_netflow_exporter_policy"
description: |-
Manages ACI Netflow Exporter Policy
---

# aci_netflow_exporter_policy #

Manages ACI Netflow Exporter Policy



## API Information ##

* Class: [netflowExporterPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/netflowExporterPol/overview)

* Supported in ACI versions: 2.2(1k) and later.

* Distinguished Name Formats:
- `uni/infra/exporterpol-{name}`
- `uni/tn-{name}/exporterpol-{name}`

## GUI Information ##

* Locations:
- `Tenants -> Policies -> NetFlow -> NetFlow Exporters`
- `Fabric -> Access Policies -> Policies -> Interface -> NetFlow -> NetFlow Exporters`

## Example Usage ##

The configuration snippet below creates a Netflow Exporter Policy with only required attributes.

```hcl
resource "aci_netflow_exporter_policy" "example_tenant" {
parent_dn = aci_tenant.example.id
name = "netfow_exporter"
}
```
The configuration snippet below shows all possible attributes of the Netflow Exporter Policy.

!> This example might not be valid configuration and is only used to show all possible attributes.

```hcl
resource "aci_netflow_exporter_policy" "full_example_tenant" {
parent_dn = aci_tenant.example.id
annotation = "annotation"
description = "description"
dscp = "AF11"
dst_addr = "2.2.2.1"
dst_port = "https"
name = "netfow_exporter"
name_alias = "name_alias"
owner_key = "owner_key"
owner_tag = "owner_tag"
source_ip_type = "custom-src-ip"
src_addr = "1.1.1.1/10"
ver = "v9"
annotations = [
{
key = "key_0"
value = "value_1"
}
]
tags = [
{
key = "key_0"
value = "value_1"
}
]
}
```

All examples for the Netflow Exporter Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_netflow_exporter_policy) folder.

## Schema ##

### Required ###

* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources:
- [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview))
- The distinguished name (DN) of classes below can be used but currently there is no available resource for it:
- [infraInfra](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/infraInfra/overview)

* `name` (name) - (string) The name of the Netflow Exporter Policy object.

### Read-Only ###

* `id` - (string) The distinguished name (DN) of the Netflow Exporter Policy object.

### Optional ###

* `annotation` (annotation) - (string) The annotation of the Netflow Exporter Policy object.
- Default: `orchestrator:terraform`
* `description` (descr) - (string) The description of the Netflow Exporter Policy object.
* `dscp` (dscp) - (string) IP dscp value.
- Default: `CS2`
- Valid Values: `AF11`, `AF12`, `AF13`, `AF21`, `AF22`, `AF23`, `AF31`, `AF32`, `AF33`, `AF41`, `AF42`, `AF43`, `CS0`, `CS1`, `CS2`, `CS3`, `CS4`, `CS5`, `CS6`, `CS7`, `EF`, `VA`.
* `dst_addr` (dstAddr) - (string) Remote node destination IP address.
* `dst_port` (dstPort) - (string) Remote node destination port.
- Default: `unspecified`
- Valid Values: `dns`, `ftpData`, `http`, `https`, `pop3`, `rtsp`, `smtp`, `ssh`, `unspecified`.
* `name_alias` (nameAlias) - (string) The name alias of the Netflow Exporter 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.
* `source_ip_type` (sourceIpType) - (string) Type of Exporter Src IP Address: Can be one of the available management IP Address for a given leaf or a custom IP Address.
- Default: `custom-src-ip`
- Valid Values: `custom-src-ip`, `inband-mgmt-ip`, `oob-mgmt-ip`, `ptep`.
* `src_addr` (srcAddr) - (string) Source IP address.
* `ver` (ver) - (string) Collector version.
- Default: `v9`
- Valid Values: `cisco-v1`, `v5`, `v9`.

* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later.

#### Required ####

* `key` (key) - (string) The key used to uniquely identify this configuration object.
* `value` (value) - (string) The value of the property.

* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later.

#### Required ####

* `key` (key) - (string) The key used to uniquely identify this configuration object.
* `value` (value) - (string) The value of the property.

## Importing

An existing Netflow Exporter 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_netflow_exporter_policy.example_tenant uni/infra/exporterpol-{name}
```

Starting in Terraform version 1.5, an existing Netflow Exporter Policy can be imported
using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration:

```
import {
id = "uni/infra/exporterpol-{name}"
to = aci_netflow_exporter_policy.example_tenant
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

data "aci_netflow_exporter_policy" "example_tenant" {
parent_dn = aci_tenant.example.id
name = "netfow_exporter"
}
14 changes: 14 additions & 0 deletions examples/data-sources/aci_netflow_exporter_policy/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
terraform {
required_providers {
aci = {
source = "ciscodevnet/aci"
}
}
}

provider "aci" {
username = ""
password = ""
url = ""
insecure = true
}
14 changes: 14 additions & 0 deletions examples/resources/aci_netflow_exporter_policy/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
terraform {
required_providers {
aci = {
source = "ciscodevnet/aci"
}
}
}

provider "aci" {
username = ""
password = ""
url = ""
insecure = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

resource "aci_netflow_exporter_policy" "full_example_tenant" {
parent_dn = aci_tenant.example.id
annotation = "annotation"
description = "description"
dscp = "AF11"
dst_addr = "2.2.2.1"
dst_port = "https"
name = "netfow_exporter"
name_alias = "name_alias"
owner_key = "owner_key"
owner_tag = "owner_tag"
source_ip_type = "custom-src-ip"
src_addr = "1.1.1.1/10"
ver = "v9"
annotations = [
{
key = "key_0"
value = "value_1"
}
]
tags = [
{
key = "key_0"
value = "value_1"
}
]
}
5 changes: 5 additions & 0 deletions examples/resources/aci_netflow_exporter_policy/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

resource "aci_netflow_exporter_policy" "example_tenant" {
parent_dn = aci_tenant.example.id
name = "netfow_exporter"
}
32 changes: 30 additions & 2 deletions gen/definitions/properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ mplsNodeSidP:
name: "node_sid_profile"
resource_required:
segment_id: "1"
name: "node_sid_profile"
loopback_address: "1.1.1.1"
datasource_required:
segment_id: "1"
datasource_non_existing:
Expand Down Expand Up @@ -327,3 +325,33 @@ netflowRecordPol:
- class_name: "fvTenant"
parent_dependency: ""
parent_dn: "aci_tenant.test.id"

netflowExporterPol:
test_values:
default:
name: "netfow_exporter_default"
dst_addr: "2.2.2.1"
src_addr: "1.1.1.1/10"
dst_port: "https"
all:
name: "netfow_exporter"
dst_addr: "12.12.12.1"
src_addr: "11.11.11.1/11"
dst_port: "ssh"
ver: "v9"
resource_required:
src_addr: "1.1.1.1/10"
name: "netfow_exporter"
dst_addr: "2.2.2.1"
dst_port: "https"
datasource_required:
name: "netfow_exporter"
datasource_non_existing:
name: "netfow_exporter_non_existing"
parents:
- class_name: "infraInfra"
parent_dependency: ""
parent_dn: "uni/infra"
- class_name: "fvTenant"
parent_dependency: ""
parent_dn: "aci_tenant.test.id"
23 changes: 22 additions & 1 deletion gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ var templateFuncs = template.FuncMap{
"containsNoneAttributeValue": ContainsNoneAttributeValue,
"definedInMap": DefinedInMap,
"add": func(val1, val2 int) int { return val1 + val2 },
"substract": func(val1, val2 int) int { return val1 - val2 },
"subtract": func(val1, val2 int) int { return val1 - val2 },
"isInterfaceSlice": IsInterfaceSlice,
"lookupTestValue": LookupTestValue,
"lookupChildTestValue": LookupChildTestValue,
"isInRequiredTestValues": IsInRequiredTestValues,
"createParentDnValue": CreateParentDnValue,
"getResourceName": GetResourceName,
"getResourceNameAsDescription": GetResourceNameAsDescription,
Expand Down Expand Up @@ -1661,3 +1662,23 @@ func GetValidValuesToRemove(classPkgName, propertyName string, definitions Defin
}
return removedValidValuesSlice
}

func IsInRequiredTestValues(classPkgName, propertyName string, definitions Definitions, testType string) bool {
if classDetails, ok := definitions.Properties[classPkgName]; ok {
for key, value := range classDetails.(map[interface{}]interface{}) {
if key.(string) == "test_values" {
for test_type, test_type_values := range value.(map[interface{}]interface{}) {
if test_type.(string) == testType {
for k := range test_type_values.(map[interface{}]interface{}) {
if k.(string) == propertyName {
return true
}
}
}
}

}
}
}
return false
}
Loading

0 comments on commit 7fa6460

Please sign in to comment.