Skip to content

Commit 82a99c7

Browse files
author
jiangong
committed
add new field redudancy_status in drg
1 parent 8945e8f commit 82a99c7

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## 3.58.1 (Unreleased)
22
### Added
33
- Support for creating `oci_database_autonomous_database` resource by cloning from a backup of an existing Autonomous Database.
4+
- Support for a new field `redundancy_status` in resource `core_drg_resource`.
45

56
## 3.58.0 (January 15, 2020)
67

oci/core_drg_resource.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ func CoreDrgResource() *schema.Resource {
4949
},
5050

5151
// Computed
52+
"redundancy_status": {
53+
Type: schema.TypeString,
54+
Computed: true,
55+
},
5256
"state": {
5357
Type: schema.TypeString,
5458
Computed: true,
@@ -99,6 +103,7 @@ type CoreDrgResourceCrud struct {
99103
Client *oci_core.VirtualNetworkClient
100104
workRequestClient *oci_work_requests.WorkRequestClient
101105
Res *oci_core.Drg
106+
RedundancyStatus *oci_core.DrgRedundancyStatus
102107
DisableNotFoundRetries bool
103108
}
104109

@@ -180,7 +185,15 @@ func (s *CoreDrgResourceCrud) Get() error {
180185
}
181186

182187
s.Res = &response.Drg
183-
return nil
188+
189+
statusRequest := oci_core.GetDrgRedundancyStatusRequest{}
190+
statusRequest.DrgId = &tmp
191+
192+
if redundancyStatusResponse, err := s.Client.GetDrgRedundancyStatus(context.Background(), statusRequest); err == nil {
193+
s.RedundancyStatus = &redundancyStatusResponse.DrgRedundancyStatus
194+
}
195+
196+
return err
184197
}
185198

186199
func (s *CoreDrgResourceCrud) Update() error {
@@ -259,6 +272,10 @@ func (s *CoreDrgResourceCrud) SetData() error {
259272
s.D.Set("time_created", s.Res.TimeCreated.String())
260273
}
261274

275+
if s.RedundancyStatus != nil {
276+
s.D.Set("redundancy_status", s.RedundancyStatus.Status)
277+
}
278+
262279
return nil
263280
}
264281

oci/core_drg_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ func TestCoreDrgResource_basic(t *testing.T) {
9393
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
9494
resource.TestCheckResourceAttrSet(resourceName, "id"),
9595
resource.TestCheckResourceAttrSet(resourceName, "state"),
96+
resource.TestCheckResourceAttrSet(resourceName, "redundancy_status"),
9697

9798
func(s *terraform.State) (err error) {
9899
resId, err = fromInstanceState(s, resourceName, "id")
@@ -120,6 +121,7 @@ func TestCoreDrgResource_basic(t *testing.T) {
120121
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
121122
resource.TestCheckResourceAttrSet(resourceName, "id"),
122123
resource.TestCheckResourceAttrSet(resourceName, "state"),
124+
resource.TestCheckResourceAttrSet(resourceName, "redundancy_status"),
123125

124126
func(s *terraform.State) (err error) {
125127
resId2, err = fromInstanceState(s, resourceName, "id")
@@ -142,6 +144,7 @@ func TestCoreDrgResource_basic(t *testing.T) {
142144
resource.TestCheckResourceAttr(resourceName, "freeform_tags.%", "1"),
143145
resource.TestCheckResourceAttrSet(resourceName, "id"),
144146
resource.TestCheckResourceAttrSet(resourceName, "state"),
147+
resource.TestCheckResourceAttrSet(resourceName, "redundancy_status"),
145148

146149
func(s *terraform.State) (err error) {
147150
resId2, err = fromInstanceState(s, resourceName, "id")

website/docs/r/core_drg.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ The following attributes are exported:
6060
* `display_name` - A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
6161
* `freeform_tags` - Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
6262
* `id` - The DRG's Oracle ID (OCID).
63+
* `redundancy_status` - The redundancy status of the DRG specified.
6364
* `state` - The DRG's current state.
6465
* `time_created` - The date and time the DRG was created, in the format defined by RFC3339. Example: `2016-08-25T21:10:29.600Z`
6566

0 commit comments

Comments
 (0)