Skip to content

Commit 3eb2648

Browse files
govindrao55jotruon
authored andcommitted
Support for OPSI service
1 parent bafd4e3 commit 3eb2648

File tree

240 files changed

+25293
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+25293
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.27.0 (Unreleased)
2+
3+
### Added
4+
- Support for `OPSI` service
5+
16
## 4.26.0 (May 12, 2021)
27

38
### Added
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// Copyright (c) 2017, 2021, 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_ocid" {}
10+
variable "enterprise_manager_bridge_ocid" {}
11+
variable "enterprise_manager_entity_id" {}
12+
variable "enterprise_manager_id" {}
13+
14+
provider "oci" {
15+
tenancy_ocid = var.tenancy_ocid
16+
user_ocid = var.user_ocid
17+
fingerprint = var.fingerprint
18+
private_key_path = var.private_key_path
19+
region = var.region
20+
}
21+
22+
resource "oci_identity_tag_namespace" "tag-namespace1" {
23+
compartment_id = var.tenancy_ocid
24+
description = "example tag namespace"
25+
name = "examples-tag-namespace-all"
26+
is_retired = false
27+
}
28+
29+
30+
resource "oci_identity_tag" "tag1" {
31+
description = "example tag"
32+
name = "example-tag"
33+
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
34+
is_cost_tracking = false
35+
is_retired = false
36+
}
37+
38+
variable "database_insight_database_type" {
39+
default = ["EXTERNAL-NONCDB"]
40+
}
41+
42+
variable "database_insight_defined_tags_value" {
43+
default = "value"
44+
}
45+
46+
variable "database_insight_entity_source" {
47+
default = "EM_MANAGED_EXTERNAL_DATABASE"
48+
}
49+
50+
variable "database_insight_fields" {
51+
default = ["databaseName", "databaseType", "compartmentId", "databaseDisplayName", "freeformTags", "definedTags", "systemTags"]
52+
}
53+
54+
variable "database_insight_freeform_tags" {
55+
default = { "bar-key" = "value" }
56+
}
57+
58+
variable "resource_status" {
59+
default = "ENABLED"
60+
}
61+
62+
// Create Database insight for EM managed External Database
63+
resource "oci_opsi_database_insight" "test_database_insight" {
64+
compartment_id = var.compartment_ocid
65+
enterprise_manager_bridge_id = var.enterprise_manager_bridge_ocid
66+
enterprise_manager_entity_identifier = var.enterprise_manager_entity_id
67+
enterprise_manager_identifier = var.enterprise_manager_id
68+
entity_source = var.database_insight_entity_source
69+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.database_insight_defined_tags_value}")}"
70+
freeform_tags = var.database_insight_freeform_tags
71+
status = var.resource_status
72+
}
73+
74+
variable "database_insight_state" {
75+
default = ["ACTIVE"]
76+
}
77+
78+
variable "database_insight_status" {
79+
default = ["ENABLED"]
80+
}
81+
82+
// List EM managed database insights
83+
data "oci_opsi_database_insights" "test_database_insights" {
84+
85+
#Optional
86+
compartment_id = var.compartment_ocid
87+
database_type = var.database_insight_database_type
88+
enterprise_manager_bridge_id = var.enterprise_manager_bridge_ocid
89+
fields = var.database_insight_fields
90+
state = var.database_insight_state
91+
status = var.database_insight_status
92+
}
93+
94+
// Get an EM managed database insight
95+
data "oci_opsi_database_insight" "test_database_insight" {
96+
database_insight_id = oci_opsi_database_insight.test_database_insight.id
97+
}
98+
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Copyright (c) 2017, 2021, 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_ocid" {}
10+
11+
12+
provider "oci" {
13+
tenancy_ocid = var.tenancy_ocid
14+
user_ocid = var.user_ocid
15+
fingerprint = var.fingerprint
16+
private_key_path = var.private_key_path
17+
region = var.region
18+
}
19+
20+
data "oci_objectstorage_namespace" "test_namespace" {
21+
compartment_id = var.compartment_ocid
22+
}
23+
24+
variable "bucket_name" {
25+
default = "em_data_collection_bucket"
26+
}
27+
28+
resource "oci_objectstorage_bucket" "test_bucket" {
29+
name = var.bucket_name
30+
compartment_id = var.compartment_ocid
31+
namespace = data.oci_objectstorage_namespace.test_namespace.namespace
32+
}
33+
34+
resource "oci_identity_tag_namespace" "tag-namespace1" {
35+
compartment_id = var.tenancy_ocid
36+
description = "example tag namespace"
37+
name = "example-tag-namespace-all"
38+
is_retired = false
39+
}
40+
41+
42+
resource "oci_identity_tag" "tag1" {
43+
description = "example tag"
44+
name = "example-tag"
45+
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
46+
is_cost_tracking = false
47+
is_retired = false
48+
}
49+
50+
51+
variable "enterprise_manager_bridge_defined_tags_value" {
52+
default = "embridge_tag_value"
53+
}
54+
55+
variable "enterprise_manager_bridge_description" {
56+
default = "Test EM Bridge Description"
57+
}
58+
59+
variable "enterprise_manager_bridge_display_name" {
60+
default = "TestEMManagedBridgeName"
61+
}
62+
63+
variable "enterprise_manager_bridge_freeform_tags" {
64+
default = { "bar-key" = "value" }
65+
}
66+
67+
variable "enterprise_manager_bridge_state" {
68+
default = ["ACTIVE"]
69+
}
70+
71+
// To Create a Enterprise Manager Bridge
72+
resource "oci_opsi_enterprise_manager_bridge" "test_enterprise_manager_bridge" {
73+
#Required
74+
compartment_id = var.compartment_ocid
75+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.enterprise_manager_bridge_defined_tags_value}")}"
76+
display_name = var.enterprise_manager_bridge_display_name
77+
freeform_tags = var.enterprise_manager_bridge_freeform_tags
78+
object_storage_bucket_name = oci_objectstorage_bucket.test_bucket.name
79+
description = var.enterprise_manager_bridge_description
80+
}
81+
82+
output "enterprise_manager_bridge_id" {
83+
value = oci_opsi_enterprise_manager_bridge.test_enterprise_manager_bridge.id
84+
}
85+
86+
// List EM Bridge present under a compartment having state ACTIVE
87+
data "oci_opsi_enterprise_manager_bridges" "test_enterprise_manager_bridges" {
88+
compartment_id = var.compartment_ocid
89+
state = var.enterprise_manager_bridge_state
90+
}
91+
92+
// Get EM Bridge for a particular id
93+
data "oci_opsi_enterprise_manager_bridge" "test_enterprise_manager_bridge" {
94+
enterprise_manager_bridge_id = oci_opsi_enterprise_manager_bridge.test_enterprise_manager_bridge.id
95+
}
96+
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
// Licensed under the Mozilla Public License v2.0
3+
4+
5+
variable "tenancy_ocid" {}
6+
variable "user_ocid" {}
7+
variable "fingerprint" {}
8+
variable "private_key_path" {}
9+
variable "region" {}
10+
variable "managed_agent_id" {}
11+
variable "compartment_ocid" {}
12+
13+
provider "oci" {
14+
tenancy_ocid = var.tenancy_ocid
15+
user_ocid = var.user_ocid
16+
fingerprint = var.fingerprint
17+
private_key_path = var.private_key_path
18+
region = var.region
19+
}
20+
21+
resource "oci_identity_tag_namespace" "tag-namespace1" {
22+
compartment_id = var.tenancy_ocid
23+
description = "example tag namespace"
24+
name = "examples-tag-namespace-all"
25+
is_retired = false
26+
}
27+
28+
resource "oci_identity_tag" "tag1" {
29+
description = "example tag"
30+
name = "example-tag"
31+
tag_namespace_id = oci_identity_tag_namespace.tag-namespace1.id
32+
is_cost_tracking = false
33+
is_retired = false
34+
}
35+
36+
variable "host_insight_defined_tags_value" {
37+
default = "value"
38+
}
39+
40+
variable "host_insight_entity_source" {
41+
default = "MACS_MANAGED_EXTERNAL_HOST"
42+
}
43+
44+
variable "host_insight_freeform_tags" {
45+
default = { "bar-key" = "value" }
46+
}
47+
48+
variable "resource_status" {
49+
default = "ENABLED"
50+
}
51+
52+
resource "oci_management_agent_management_agent" "test_management_agent" {
53+
managed_agent_id = var.managed_agent_id
54+
}
55+
56+
// To Create a Host insight
57+
resource "oci_opsi_host_insight" "test_host_insight" {
58+
compartment_id = var.compartment_ocid
59+
entity_source = var.host_insight_entity_source
60+
management_agent_id = oci_management_agent_management_agent.test_management_agent.id
61+
defined_tags = "${map("${oci_identity_tag_namespace.tag-namespace1.name}.${oci_identity_tag.tag1.name}", "${var.host_insight_defined_tags_value}")}"
62+
freeform_tags = var.host_insight_freeform_tags
63+
status = var.resource_status
64+
}
65+
66+
67+
variable "host_insight_host_type" {
68+
default = ["EXTERNAL-HOST"]
69+
}
70+
71+
variable "host_insight_state" {
72+
default = ["ACTIVE"]
73+
}
74+
75+
variable "host_insight_status" {
76+
default = ["ENABLED"]
77+
}
78+
79+
// List host insight
80+
data "oci_opsi_host_insights" "test_host_insights" {
81+
compartment_id = var.compartment_ocid
82+
host_type = var.host_insight_host_type
83+
state = var.host_insight_state
84+
status = var.host_insight_status
85+
}
86+
87+
// Get an host insight
88+
data "oci_opsi_host_insight" "test_host_insight" {
89+
host_insight_id = oci_opsi_host_insight.test_host_insight.id
90+
}
91+

oci/export_definitions.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141
oci_ocvp "github.com/oracle/oci-go-sdk/v40/ocvp"
4242
oci_oda "github.com/oracle/oci-go-sdk/v40/oda"
4343
oci_ons "github.com/oracle/oci-go-sdk/v40/ons"
44+
oci_opsi "github.com/oracle/oci-go-sdk/v40/opsi"
4445
oci_optimizer "github.com/oracle/oci-go-sdk/v40/optimizer"
4546
oci_osmanagement "github.com/oracle/oci-go-sdk/v40/osmanagement"
4647
oci_sch "github.com/oracle/oci-go-sdk/v40/sch"
@@ -1918,6 +1919,42 @@ var exportOnsSubscriptionHints = &TerraformResourceHints{
19181919
},
19191920
}
19201921

1922+
var exportOpsiEnterpriseManagerBridgeHints = &TerraformResourceHints{
1923+
resourceClass: "oci_opsi_enterprise_manager_bridge",
1924+
datasourceClass: "oci_opsi_enterprise_manager_bridges",
1925+
datasourceItemsAttr: "enterprise_manager_bridge_collection",
1926+
isDatasourceCollection: true,
1927+
resourceAbbreviation: "enterprise_manager_bridge",
1928+
requireResourceRefresh: true,
1929+
discoverableLifecycleStates: []string{
1930+
string(oci_opsi.LifecycleStateActive),
1931+
},
1932+
}
1933+
1934+
var exportOpsiDatabaseInsightHints = &TerraformResourceHints{
1935+
resourceClass: "oci_opsi_database_insight",
1936+
datasourceClass: "oci_opsi_database_insights",
1937+
datasourceItemsAttr: "database_insights_collection",
1938+
isDatasourceCollection: true,
1939+
resourceAbbreviation: "database_insight",
1940+
requireResourceRefresh: true,
1941+
discoverableLifecycleStates: []string{
1942+
string(oci_opsi.LifecycleStateActive),
1943+
},
1944+
}
1945+
1946+
var exportOpsiHostInsightHints = &TerraformResourceHints{
1947+
resourceClass: "oci_opsi_host_insight",
1948+
datasourceClass: "oci_opsi_host_insights",
1949+
datasourceItemsAttr: "host_insight_summary_collection",
1950+
isDatasourceCollection: true,
1951+
resourceAbbreviation: "host_insight",
1952+
requireResourceRefresh: true,
1953+
discoverableLifecycleStates: []string{
1954+
string(oci_opsi.LifecycleStateActive),
1955+
},
1956+
}
1957+
19211958
var exportOptimizerProfileHints = &TerraformResourceHints{
19221959
resourceClass: "oci_optimizer_profile",
19231960
datasourceClass: "oci_optimizer_profiles",

oci/export_graphs.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var compartmentResourceGraphs = map[string]TerraformResourceGraph{
5151
"ocvp": ocvpResourceGraph,
5252
"oda": odaResourceGraph,
5353
"ons": onsResourceGraph,
54+
"opsi": opsiResourceGraph,
5455
"osmanagement": osmanagementResourceGraph,
5556
"sch": schResourceGraph,
5657
"streaming": streamingResourceGraph,
@@ -881,6 +882,14 @@ var onsResourceGraph = TerraformResourceGraph{
881882
},
882883
}
883884

885+
var opsiResourceGraph = TerraformResourceGraph{
886+
"oci_identity_compartment": {
887+
{TerraformResourceHints: exportOpsiEnterpriseManagerBridgeHints},
888+
{TerraformResourceHints: exportOpsiDatabaseInsightHints},
889+
{TerraformResourceHints: exportOpsiHostInsightHints},
890+
},
891+
}
892+
884893
var optimizerResourceGraph = TerraformResourceGraph{
885894
"oci_identity_tenancy": {
886895
{TerraformResourceHints: exportOptimizerProfileHints},

0 commit comments

Comments
 (0)