diff --git a/service/regions/model.go b/service/regions/model.go index 8323eac..42a2fc2 100644 --- a/service/regions/model.go +++ b/service/regions/model.go @@ -34,11 +34,14 @@ type Database struct { } type CreateRegion struct { - Region *string `json:"region,omitempty"` - DeploymentCIDR *string `json:"deploymentCIDR,omitempty"` - DryRun *bool `json:"dryRun,omitempty"` - RespVersion *string `json:"respVersion,omitempty"` - Databases []*CreateDatabase `json:"databases,omitempty"` + Region *string `json:"region,omitempty"` + DeploymentCIDR *string `json:"deploymentCIDR,omitempty"` + DryRun *bool `json:"dryRun,omitempty"` + RespVersion *string `json:"respVersion,omitempty"` + VpcId *string `json:"vpcId,omitempty"` + SubnetIds []*string `json:"subnetIds,omitempty"` + SecurityGroupId *string `json:"securityGroupId,omitempty"` + Databases []*CreateDatabase `json:"databases,omitempty"` } type DeleteRegion struct { diff --git a/service/subscriptions/model.go b/service/subscriptions/model.go index fe45dad..6752238 100644 --- a/service/subscriptions/model.go +++ b/service/subscriptions/model.go @@ -46,8 +46,10 @@ func (o CreateRegion) String() string { } type CreateNetworking struct { - DeploymentCIDR *string `json:"deploymentCIDR,omitempty"` - VPCId *string `json:"vpcId,omitempty"` + DeploymentCIDR *string `json:"deploymentCIDR,omitempty"` + VPCId *string `json:"vpcId,omitempty"` + SubnetIds []*string `json:"subnetIds,omitempty"` + SecurityGroupId *string `json:"securityGroupId,omitempty"` } func (o CreateNetworking) String() string { @@ -143,6 +145,31 @@ type Subscription struct { PublicEndpointAccess *bool `json:"publicEndpointAccess,omitempty"` } +type ActiveActiveSubscription struct { + ID *int `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Status *string `json:"status,omitempty"` + DeploymentType *string `json:"deploymentType,omitempty"` + PaymentMethod *string `json:"paymentMethodType,omitempty"` + PaymentMethodID *int `json:"paymentMethodId,omitempty"` + MemoryStorage *string `json:"memoryStorage,omitempty"` + StorageEncryption *bool `json:"storageEncryption,omitempty"` + NumberOfDatabases *int `json:"numberOfDatabases,omitempty"` + CloudDetails []*ActiveActiveCloudDetail `json:"cloudDetails,omitempty"` + PersistentStorageEncryptionType *string `json:"persistentStorageEncryptionType,omitempty"` + DeletionGracePeriod *string `json:"deletionGracePeriod,omitempty"` + CustomerManagedKeyAccessDetails *CustomerManagedKeyAccessDetails `json:"customerManagedKeyAccessDetails,omitempty"` + PublicEndpointAccess *bool `json:"publicEndpointAccess,omitempty"` +} + +type ActiveActiveCloudDetail struct { + Provider *string `json:"provider,omitempty"` + CloudAccountID *int `json:"cloudAccountId,omitempty"` + AWSAccountID *string `json:"awsAccountId,omitempty"` + TotalSizeInGB *float64 `json:"totalSizeInGb,omitempty"` + Regions []*ActiveActiveRegion `json:"regions,omitempty"` +} + type CustomerManagedKeyAccessDetails struct { RedisServiceAccount *string `json:"redisServiceAccount,omitempty"` GooglePredefinedRoles []*string `json:"googlePredefinedRoles,omitempty"` @@ -307,6 +334,10 @@ type listSubscriptionResponse struct { Subscriptions []*Subscription `json:"subscriptions"` } +type listActiveActiveSubscriptionResponse struct { + Subscriptions []*ActiveActiveSubscription `json:"subscriptions"` +} + type ListAASubscriptionRegionsResponse struct { SubscriptionId *int `json:"subscriptionId,omitempty"` Regions []*ActiveActiveRegion `json:"regions"` diff --git a/service/subscriptions/service.go b/service/subscriptions/service.go index 9e755fd..ce6ac3a 100644 --- a/service/subscriptions/service.go +++ b/service/subscriptions/service.go @@ -65,6 +65,22 @@ func (a *API) List(ctx context.Context) ([]*Subscription, error) { return response.Subscriptions, nil } +// ListActiveActive will list all of the current account's active-active subscriptions. +func (a *API) ListActiveActive(ctx context.Context) ([]*ActiveActiveSubscription, error) { + var response listActiveActiveSubscriptionResponse + err := a.client.Get(ctx, "list subscriptions", "/subscriptions", &response) + if err != nil { + return nil, err + } + var activeActiveSubscriptions []*ActiveActiveSubscription + for _, sub := range response.Subscriptions { + if *sub.DeploymentType == "active-active" { + activeActiveSubscriptions = append(activeActiveSubscriptions, sub) + } + } + return activeActiveSubscriptions, nil +} + // Get will retrieve an existing subscription. func (a *API) Get(ctx context.Context, id int) (*Subscription, error) { var response Subscription @@ -76,6 +92,17 @@ func (a *API) Get(ctx context.Context, id int) (*Subscription, error) { return &response, nil } +// GetActiveActive will retrieve an existing active-active subscription. +func (a *API) GetActiveActive(ctx context.Context, id int) (*ActiveActiveSubscription, error) { + var response ActiveActiveSubscription + err := a.client.Get(ctx, fmt.Sprintf("retrieve subscription %d", id), fmt.Sprintf("/subscriptions/%d", id), &response) + if err != nil { + return nil, wrap404Error(id, err) + } + + return &response, nil +} + // Update will make changes to an existing subscription. func (a *API) Update(ctx context.Context, id int, subscription UpdateSubscription) error { var task internal.TaskResponse