Skip to content

Commit f48292b

Browse files
Girish JambagiMaxrovr
authored andcommitted
Added - Support for Security Attributes
1 parent d87fcf9 commit f48292b

22 files changed

+2842
-0
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
variable "tenancy_ocid" {}
5+
variable "user_ocid" {}
6+
variable "fingerprint" {}
7+
variable "private_key_path" {}
8+
variable "region" {}
9+
variable "compartment_id" {}
10+
11+
variable "security_attribute_namespace_compartment_id_in_subtree" {
12+
default = false
13+
}
14+
15+
variable "security_attribute_namespace_defined_tags_value" {
16+
default = "value"
17+
}
18+
19+
variable "security_attribute_namespace_description" {
20+
default = "This is the Zero Trust Packet Routing security attribute namespace description sample."
21+
}
22+
23+
variable "security_attribute_namespace_freeform_tags" {
24+
default = { "Department" = "Finance" }
25+
}
26+
27+
variable "security_attribute_namespace_name" {
28+
default = "example-security-attribute-namespace"
29+
}
30+
31+
variable "security_attribute_namespace_state" {
32+
default = "ACTIVE"
33+
}
34+
35+
variable "security_attribute_description" {
36+
default = "This is a sample security attribute description."
37+
}
38+
39+
variable "security_attribute_name" {
40+
default = "TFTestSecurityAttribute"
41+
}
42+
43+
variable "security_attribute_state" {
44+
default = "ACTIVE"
45+
}
46+
47+
variable "security_attribute_validator_validator_type" {
48+
default = "ENUM"
49+
}
50+
51+
variable "security_attribute_validator_values" {
52+
default = []
53+
}
54+
55+
provider "oci" {
56+
tenancy_ocid = var.tenancy_ocid
57+
user_ocid = var.user_ocid
58+
fingerprint = var.fingerprint
59+
private_key_path = var.private_key_path
60+
region = var.region
61+
}
62+
63+
resource "oci_security_attribute_security_attribute_namespace" "test_security_attribute_namespace" {
64+
#Required
65+
compartment_id = var.compartment_id
66+
description = var.security_attribute_namespace_description
67+
name = var.security_attribute_namespace_name
68+
69+
#Optional
70+
#defined_tags = map(oci_identity_tag_namespace.tag-namespace1.name.oci_identity_tag.tag1.name, var.security_attribute_namespace_defined_tags_value)
71+
freeform_tags = var.security_attribute_namespace_freeform_tags
72+
}
73+
74+
data "oci_security_attribute_security_attribute_namespaces" "test_security_attribute_namespaces" {
75+
#Required
76+
compartment_id = var.compartment_id
77+
78+
#Optional
79+
compartment_id_in_subtree = var.security_attribute_namespace_compartment_id_in_subtree
80+
name = var.security_attribute_namespace_name
81+
state = var.security_attribute_namespace_state
82+
}
83+
84+
resource "oci_security_attribute_security_attribute" "test_security_attribute" {
85+
#Required
86+
description = var.security_attribute_description
87+
name = var.security_attribute_name
88+
security_attribute_namespace_id = oci_security_attribute_security_attribute_namespace.test_security_attribute_namespace.id
89+
90+
#Optional
91+
validator {
92+
#Required
93+
validator_type = var.security_attribute_validator_validator_type
94+
95+
#Optional
96+
values = var.security_attribute_validator_values
97+
}
98+
}
99+
100+
data "oci_security_attribute_security_attributes" "test_security_attributes" {
101+
#Required
102+
security_attribute_namespace_id = oci_security_attribute_security_attribute_namespace.test_security_attribute_namespace.id
103+
104+
#Optional
105+
state = var.security_attribute_state
106+
}
107+
108+
data "oci_security_attribute_security_attribute" "test_security_attribute" {
109+
#Required
110+
security_attribute_name = oci_security_attribute_security_attribute.test_security_attribute.name
111+
security_attribute_namespace_id = oci_security_attribute_security_attribute_namespace.test_security_attribute_namespace.id
112+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
package client
5+
6+
import (
7+
oci_security_attribute "github.com/oracle/oci-go-sdk/v65/securityattribute"
8+
9+
oci_common "github.com/oracle/oci-go-sdk/v65/common"
10+
)
11+
12+
func init() {
13+
RegisterOracleClient("oci_security_attribute.SecurityAttributeClient", &OracleClient{InitClientFn: initSecurityattributeSecurityAttributeClient})
14+
}
15+
16+
func initSecurityattributeSecurityAttributeClient(configProvider oci_common.ConfigurationProvider, configureClient ConfigureClient, serviceClientOverrides ServiceClientOverrides) (interface{}, error) {
17+
client, err := oci_security_attribute.NewSecurityAttributeClientWithConfigurationProvider(configProvider)
18+
if err != nil {
19+
return nil, err
20+
}
21+
err = configureClient(&client.BaseClient)
22+
if err != nil {
23+
return nil, err
24+
}
25+
26+
if serviceClientOverrides.HostUrlOverride != "" {
27+
client.Host = serviceClientOverrides.HostUrlOverride
28+
}
29+
return &client, nil
30+
}
31+
32+
func (m *OracleClients) SecurityAttributeClient() *oci_security_attribute.SecurityAttributeClient {
33+
return m.GetClient("oci_security_attribute.SecurityAttributeClient").(*oci_security_attribute.SecurityAttributeClient)
34+
}

0 commit comments

Comments
 (0)