Skip to content

Commit

Permalink
Fix trustsec egress matrix cell resource put issue
Browse files Browse the repository at this point in the history
  • Loading branch information
danischm committed Oct 10, 2023
1 parent 5ec24d1 commit df0e612
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 51 deletions.
2 changes: 1 addition & 1 deletion docs/resources/trustsec_egress_matrix_cell.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This resource can manage a TrustSec Egress Matrix Cell.
resource "ise_trustsec_egress_matrix_cell" "example" {
description = "EgressMatrixCell Description"
matrix_cell_status = "ENABLED"
sgacls = ["26b76b10-66e6-11ee-9cc1-9eb2a3ecc82a,9d64dcd0-6384-11ee-9cc1-9eb2a3ecc82a"]
sgacls = ["26b76b10-66e6-11ee-9cc1-9eb2a3ecc82a, 9d64dcd0-6384-11ee-9cc1-9eb2a3ecc82a"]
source_sgt_id = "93c66ed0-8c01-11e6-996c-525400b48521"
destination_sgt_id = "93e1bf00-8c01-11e6-996c-525400b48521"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "ise_trustsec_egress_matrix_cell" "example" {
description = "EgressMatrixCell Description"
matrix_cell_status = "ENABLED"
sgacls = ["26b76b10-66e6-11ee-9cc1-9eb2a3ecc82a,9d64dcd0-6384-11ee-9cc1-9eb2a3ecc82a"]
sgacls = ["26b76b10-66e6-11ee-9cc1-9eb2a3ecc82a, 9d64dcd0-6384-11ee-9cc1-9eb2a3ecc82a"]
source_sgt_id = "93c66ed0-8c01-11e6-996c-525400b48521"
destination_sgt_id = "93e1bf00-8c01-11e6-996c-525400b48521"
}
8 changes: 4 additions & 4 deletions gen/definitions/trustsec_egress_matrix_cell.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: TrustSec Egress Matrix Cell
rest_endpoint: /ers/config/egressmatrixcell
doc_category: TrustSec
id_path: response.id
skip_minimum_test: true
put_id_include_path: EgressMatrixCell
attributes:
- model_name: description
data_path: [EgressMatrixCell]
Expand All @@ -13,15 +13,15 @@ attributes:
- model_name: defaultRule
data_path: [EgressMatrixCell]
type: String
enum_values: [NONE,DENY_IP,PERMIT_IP]
enum_values: [NONE, DENY_IP, PERMIT_IP]
description: "Can be used only if sgacls not specified."
example: "PERMIT_IP"
default_value: "NONE"
exclude_test: true
- model_name: matrixCellStatus
data_path: [EgressMatrixCell]
type: String
enum_values: [DISABLED,ENABLED,MONITOR]
enum_values: [DISABLED, ENABLED, MONITOR]
default_value: "DISABLED"
example: "ENABLED"
description: "Matrix Cell Status"
Expand All @@ -32,7 +32,7 @@ attributes:
type: StringList
test_value: "[ise_trustsec_security_group_acl.test.id]"
description: List of TrustSec Security Groups ACLs
example: "26b76b10-66e6-11ee-9cc1-9eb2a3ecc82a,9d64dcd0-6384-11ee-9cc1-9eb2a3ecc82a"
example: "26b76b10-66e6-11ee-9cc1-9eb2a3ecc82a, 9d64dcd0-6384-11ee-9cc1-9eb2a3ecc82a"
- model_name: sourceSgtId
data_path: [EgressMatrixCell]
type: String
Expand Down
1 change: 1 addition & 0 deletions gen/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type YamlConfig struct {
RootList bool `yaml:"root_list"`
NoReadPrefix bool `yaml:"no_read_prefix"`
IdPath string `yaml:"id_path"`
PutIdIncludePath string `yaml:"put_id_include_path"`
MinimumVersion string `yaml:"minimum_version"`
DsDescription string `yaml:"ds_description"`
ResDescription string `yaml:"res_description"`
Expand Down
91 changes: 46 additions & 45 deletions gen/schema/schema.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
---
name: str() # Name of the resource
rest_endpoint: str(required=False) # REST endpoint path
get_no_id: bool(required=False) # Set to true if the GET request does not require an ID
no_delete: bool(required=False) # Set to true if the DELETE request is not supported
post_update: bool(required=False) # Set to true if the POST request is used for update
root_list: bool(required=False) # Set to true if the root element of the data structure is a list
no_read_prefix: bool(required=False) # Set to true if it is an Open API endpoint put the response is not embeeded into a "response" element
id_path: str(required=False) # Path to the ID in the response (use "." to access nested elements)
minimum_version: str(required=False) # Define a minimum supported version
ds_description: str(required=False) # Define a data source description
res_description: str(required=False) # Define a resource description
doc_category: str(required=False) # Define a documentation category
skip_minimum_test: bool(required=False) # Do not perform a "minimum" (only mandatory attributes) test
attributes: list(include('attribute'), required=False) # List of attributes
test_tags: list(str(), required=False) # List of test tags, tests are only executed if an environment variable with one of these tags is configured
test_prerequisites: str(required=False) # HCL code that is included in the acceptance tests to define prerequisites
name: str() # Name of the resource
rest_endpoint: str(required=False) # REST endpoint path
get_no_id: bool(required=False) # Set to true if the GET request does not require an ID
no_delete: bool(required=False) # Set to true if the DELETE request is not supported
post_update: bool(required=False) # Set to true if the POST request is used for update
root_list: bool(required=False) # Set to true if the root element of the data structure is a list
no_read_prefix: bool(required=False) # Set to true if it is an Open API endpoint put the response is not embeeded into a "response" element
id_path: str(required=False) # Path to the ID in the response (use "." to access nested elements)
put_id_include_path: str(required=False) # If PUT needs to have specify JSON path where ID should be inserted
minimum_version: str(required=False) # Define a minimum supported version
ds_description: str(required=False) # Define a data source description
res_description: str(required=False) # Define a resource description
doc_category: str(required=False) # Define a documentation category
skip_minimum_test: bool(required=False) # Do not perform a "minimum" (only mandatory attributes) test
attributes: list(include('attribute'), required=False) # List of attributes
test_tags: list(str(), required=False) # List of test tags, tests are only executed if an environment variable with one of these tags is configured
test_prerequisites: str(required=False) # HCL code that is included in the acceptance tests to define prerequisites
---
attribute:
model_name: str(required=False) # Name of the attribute in the model (payload)
tf_name: str(required=False) # Name of the attribute in the Terraform resource, by default derived from model_name
type: enum('String', 'Int64', 'Float', 'Bool', 'List', 'Set', 'StringList', required=False) # Type of the attribute
data_path: list(str(), required=False) # Path to the attribute in the model structure
id: bool(required=False) # Set to true if the attribute is part of the ID
reference: bool(required=False) # Set to true if the attribute is a reference being used in the path (URL) of the REST endpoint
mandatory: bool(required=False) # Set to true if the attribute is mandatory
write_only: bool(required=False) # Set to true if the attribute is write-only, meaning we cannot read the value
write_changes_only: bool(required=False) # Set to true if the attribute should only be written (included in PUT payload) if it has changed
exclude_test: bool(required=False) # Exclude attribute from example (documentation) and acceptance test
exclude_example: bool(required=False) # Exclude attribute from acceptance test only (example/documentation is still generated)
description: str(required=False) # Attribute description
example: any(str(), int(), bool(), required=False) # Example value for documentation, also used for acceptance test
enum_values: list(str(), required=False) # List of enum values, only relevant if type is "String"
min_list: int(required=False) # Minimum number of elements in a list, only relevant if type is "List"
max_list: int(required=False) # Maximum number of elements in a list, only relevant if type is "List"
min_int: int(required=False) # Minimum value of an integer, only relevant if type is "Int64"
max_int: int(required=False) # Maximum value of an integer, only relevant if type is "Int64"
min_float: num(required=False) # Minimum value of a float, only relevant if type is "Float"
max_float: num(required=False) # Maximum value of a float, only relevant if type is "Float"
string_patterns: list(str(), required=False) # List of regular expressions that the string must match, only relevant if type is "String"
string_min_length: int(required=False) # Minimum length of a string, only relevant if type is "String"
string_max_length: int(required=False) # Maximum length of a string, only relevant if type is "String"
default_value: any(str(), int(), bool(), required=False) # Default value for the attribute
value: any(str(), int(), bool(), required=False) # Hardcoded value for the attribute
test_value: str(required=False) # Value used for acceptance test
minimum_test_value: str(required=False) # Value used for "minimum" resource acceptance test
test_tags: list(str(), required=False) # List of test tags, attribute is only included in acceptance tests if an environment variable with one of these tags is configured
attributes: list(include('attribute'), required=False) # List of attributes, only relevant if type is "List" or "Set"
model_name: str(required=False) # Name of the attribute in the model (payload)
tf_name: str(required=False) # Name of the attribute in the Terraform resource, by default derived from model_name
type: enum('String', 'Int64', 'Float', 'Bool', 'List', 'Set', 'StringList', required=False) # Type of the attribute
data_path: list(str(), required=False) # Path to the attribute in the model structure
id: bool(required=False) # Set to true if the attribute is part of the ID
reference: bool(required=False) # Set to true if the attribute is a reference being used in the path (URL) of the REST endpoint
mandatory: bool(required=False) # Set to true if the attribute is mandatory
write_only: bool(required=False) # Set to true if the attribute is write-only, meaning we cannot read the value
write_changes_only: bool(required=False) # Set to true if the attribute should only be written (included in PUT payload) if it has changed
exclude_test: bool(required=False) # Exclude attribute from example (documentation) and acceptance test
exclude_example: bool(required=False) # Exclude attribute from acceptance test only (example/documentation is still generated)
description: str(required=False) # Attribute description
example: any(str(), int(), bool(), required=False) # Example value for documentation, also used for acceptance test
enum_values: list(str(), required=False) # List of enum values, only relevant if type is "String"
min_list: int(required=False) # Minimum number of elements in a list, only relevant if type is "List"
max_list: int(required=False) # Maximum number of elements in a list, only relevant if type is "List"
min_int: int(required=False) # Minimum value of an integer, only relevant if type is "Int64"
max_int: int(required=False) # Maximum value of an integer, only relevant if type is "Int64"
min_float: num(required=False) # Minimum value of a float, only relevant if type is "Float"
max_float: num(required=False) # Maximum value of a float, only relevant if type is "Float"
string_patterns: list(str(), required=False) # List of regular expressions that the string must match, only relevant if type is "String"
string_min_length: int(required=False) # Minimum length of a string, only relevant if type is "String"
string_max_length: int(required=False) # Maximum length of a string, only relevant if type is "String"
default_value: any(str(), int(), bool(), required=False) # Default value for the attribute
value: any(str(), int(), bool(), required=False) # Hardcoded value for the attribute
test_value: str(required=False) # Value used for acceptance test
minimum_test_value: str(required=False) # Value used for "minimum" resource acceptance test
test_tags: list(str(), required=False) # List of test tags, attribute is only included in acceptance tests if an environment variable with one of these tags is configured
attributes: list(include('attribute'), required=False) # List of attributes, only relevant if type is "List" or "Set"
5 changes: 5 additions & 0 deletions gen/templates/model.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/provider/model_ise_trustsec_egress_matrix_cell.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit df0e612

Please sign in to comment.