Skip to content

Commit 1918f99

Browse files
rtumkurkMaxrovr
authored andcommitted
Added examples and tests
1 parent 3aed153 commit 1918f99

15 files changed

+1758
-0
lines changed
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
// Copyright (c) 2017, 2023, 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 "compartment_id" {}
9+
10+
variable "occ_demand_signal_display_name"{
11+
default = "displayName"
12+
}
13+
14+
variable "occ_demand_signal_id" {
15+
default = "ocid1.service.oc17.us-dcc-phoenix-1.amaaaaaaujlzuraaubiigpp72ftrx7pdok7l3cpt6ejybth24tsr4qeykeeq"
16+
}
17+
18+
variable "occ_demand_signal_resource_type" {
19+
default = "Compute - Std Intel"
20+
}
21+
22+
variable "occ_demand_signal_units" {
23+
default = "(Cores)"
24+
}
25+
26+
variable "occ_demand_signal_time_expected" {
27+
default = "2025-01-05T00:00:00.000Z"
28+
}
29+
30+
variable "occ_demand_signal_value" {
31+
default = 100
32+
}
33+
34+
variable "occ_demand_signal_comments" {
35+
default = "comments"
36+
}
37+
38+
variable "occ_demand_signal_is_active" {
39+
default = false
40+
}
41+
42+
variable "occ_demand_signal_state" {
43+
default = "ACTIVE"
44+
}
45+
46+
variable "occ_demand_signal_defined_tags_value" {
47+
default = "value"
48+
}
49+
50+
variable "occ_demand_signal_freeform_tags" {
51+
default = { "bar-key" = "value" }
52+
}
53+
54+
variable "occ_demand_signal_lifecycle_details" {
55+
default = "lifecycleDetails"
56+
}
57+
58+
variable "occ_demand_signal_test_occ_demand_signals" {
59+
default = [" "]
60+
}
61+
62+
variable "occ_demand_signal_test_value" {
63+
default = [
64+
{
65+
time_expected = "2025-01-05T00:00:00.000Z"
66+
value = "100"
67+
},
68+
{
69+
time_expected = "2025-02-05T00:00:00.000Z"
70+
value = "100"
71+
},
72+
{
73+
time_expected = "2025-03-05T00:00:00.000Z"
74+
value = "100"
75+
},
76+
{
77+
time_expected = "2025-04-05T00:00:00.000Z"
78+
value = "100"
79+
},
80+
{
81+
time_expected = "2025-05-05T00:00:00.000Z"
82+
value = "100"
83+
},
84+
{
85+
time_expected = "2025-06-05T00:00:00.000Z"
86+
value = "100"
87+
},
88+
{
89+
time_expected = "2025-07-05T00:00:00.000Z"
90+
value = "100"
91+
},
92+
{
93+
time_expected = "2025-08-05T00:00:00.000Z"
94+
value = "100"
95+
},
96+
{
97+
time_expected = "2025-09-05T00:00:00.000Z"
98+
value = "100"
99+
},
100+
{
101+
time_expected = "2025-10-05T00:00:00.000Z"
102+
value = "100"
103+
},
104+
{
105+
time_expected = "2025-11-05T00:00:00.000Z"
106+
value = "100"
107+
},
108+
{
109+
time_expected = "2025-12-05T00:00:00.000Z"
110+
value = "100"
111+
}
112+
]
113+
114+
}
115+
provider "oci" {
116+
tenancy_ocid = var.tenancy_ocid
117+
user_ocid = var.user_ocid
118+
fingerprint = var.fingerprint
119+
private_key_path = var.private_key_path
120+
}
121+
122+
resource "oci_demand_signal_occ_demand_signal" "test_occ_demand_signal" {
123+
#Required
124+
compartment_id = var.compartment_id
125+
is_active = var.occ_demand_signal_is_active
126+
occ_demand_signals {
127+
resource_type = var.occ_demand_signal_resource_type
128+
units = var.occ_demand_signal_units
129+
values {
130+
time_expected = var.occ_demand_signal_time_expected
131+
value = var.occ_demand_signal_value
132+
#Optional
133+
comments = var.occ_demand_signal_comments
134+
}
135+
}
136+
#Optional
137+
display_name = var.occ_demand_signal_display_name
138+
id = var.occ_demand_signal_id
139+
state = var.occ_demand_signal_state
140+
freeform_tags = var.occ_demand_signal_freeform_tags
141+
lifecycle_details = var.occ_demand_signal_lifecycle_details
142+
patch_operations {
143+
#Required
144+
from = var.occ_demand_signal_patch_operations_from
145+
operation = var.occ_demand_signal_patch_operations_operation
146+
value = var.occ_demand_signal_patch_operations_value
147+
selection = var.occ_demand_signal_patch_operations_selection
148+
#Optional
149+
position = var.occ_demand_signal_patch_operations_position
150+
selected_item = var.occ_demand_signal_patch_operations_selected_item
151+
152+
}
153+
}
154+
155+
data "oci_demand_signal_occ_demand_signals" "test_occ_demand_signals" {
156+
#Required
157+
compartment_id = var.compartment_id
158+
159+
#Optional
160+
display_name = var.occ_demand_signal_display_name
161+
id = var.occ_demand_signal_id
162+
state = var.occ_demand_signal_state
163+
}
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_demand_signal "github.com/oracle/oci-go-sdk/v65/demandsignal"
8+
9+
oci_common "github.com/oracle/oci-go-sdk/v65/common"
10+
)
11+
12+
func init() {
13+
RegisterOracleClient("oci_demand_signal.OccDemandSignalClient", &OracleClient{InitClientFn: initDemandsignalOccDemandSignalClient})
14+
}
15+
16+
func initDemandsignalOccDemandSignalClient(configProvider oci_common.ConfigurationProvider, configureClient ConfigureClient, serviceClientOverrides ServiceClientOverrides) (interface{}, error) {
17+
client, err := oci_demand_signal.NewOccDemandSignalClientWithConfigurationProvider(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) OccDemandSignalClient() *oci_demand_signal.OccDemandSignalClient {
33+
return m.GetClient("oci_demand_signal.OccDemandSignalClient").(*oci_demand_signal.OccDemandSignalClient)
34+
}

0 commit comments

Comments
 (0)