Skip to content

Commit

Permalink
added lcm struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishekism9450 committed Jan 13, 2023
1 parent 57506ac commit 3b223e0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
14 changes: 11 additions & 3 deletions client/era/era_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,17 @@ type UnRegisterDatabaseRequest struct {
DeleteTimeMachine bool `json:"deleteTimeMachine,omitempty"`
}
type DatabaseSnapshotRequest struct {
Name *string `json:"name,omitempty"`
LcmConfig *LcmConfig `json:"lcmConfig,omitempty"`
ReplicateToClusters []*string `json:"replicateToClusterIds,omitempty"`
Name *string `json:"name,omitempty"`
LcmConfig *LCMConfigSnapshot `json:"lcmConfig,omitempty"`
ReplicateToClusters []*string `json:"replicateToClusterIds,omitempty"`
}

type LCMConfigSnapshot struct {
SnapshotLCMConfig *SnapshotLCMConfig `json:"snapshotLCMConfig,omitempty"`
}

type SnapshotLCMConfig struct {
ExpiryDetails *DBExpiryDetails `json:"expiryDetails,omitempty"`
}

type ListTimeMachines []*TimeMachine
Expand Down
15 changes: 13 additions & 2 deletions nutanix/resource_nutanix_ndb_database_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ func resourceNutanixNDBDatabaseSnapshot() *schema.Resource {
Type: schema.TypeInt,
Optional: true,
},
"expiry_date_timezone": {
Type: schema.TypeString,
Optional: true,
Default: "Asia/Calcutta",
},
"replicate_to_clusters": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -283,12 +288,18 @@ func resourceNutanixNDBDatabaseSnapshotCreate(ctx context.Context, d *schema.Res
}

if rm, ok := d.GetOk("remove_schedule_in_days"); ok {
lcmConfig := &era.LcmConfig{}
lcmConfig := &era.LCMConfigSnapshot{}
snapshotLCM := &era.SnapshotLCMConfig{}
expDetails := &era.DBExpiryDetails{}

expDetails.ExpireInDays = utils.IntPtr(rm.(int))

lcmConfig.ExpiryDetails = expDetails
if tmzone, pk := d.GetOk("expiry_date_timezone"); pk {
expDetails.ExpiryDateTimezone = utils.StringPtr(tmzone.(string))
}

snapshotLCM.ExpiryDetails = expDetails
lcmConfig.SnapshotLCMConfig = snapshotLCM
req.LcmConfig = lcmConfig
}

Expand Down

0 comments on commit 3b223e0

Please sign in to comment.