diff --git a/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go index 17449325861..7f4ef6edd53 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/get/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go index 04df0597abd..f4b03f64482 100644 --- a/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/get/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go index c2f31e4cfc7..d4e2552112f 100644 --- a/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/patch/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go index 00b80cf489b..15d26059cff 100644 --- a/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/patch/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go index 700e7f47af0..7669b6ae78d 100644 --- a/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/post/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go index ab557aada0c..a400b59b083 100644 --- a/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/post/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go index f6fdab8b586..aab36e3c9aa 100644 --- a/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/put/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go index c6c4a84ac0e..8f0fa9efafe 100644 --- a/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/put/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go index ec4f109cdf0..a817745d831 100644 --- a/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/standardoperation/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "mongoDbConnectionInfo") { + if strings.EqualFold(value, "MongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go index c218c28c2d8..9f647ecb19e 100644 --- a/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/standardoperation/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "mongoDbConnectionInfo" + decoded["type"] = "MongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go index 75a9f172f04..41c28de5b58 100644 --- a/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/taskresource/model_connectioninfo.go @@ -63,7 +63,7 @@ func UnmarshalConnectionInfoImplementation(input []byte) (ConnectionInfo, error) return out, nil } - if strings.EqualFold(value, "MongoDbConnectionInfo") { + if strings.EqualFold(value, "mongoDbConnectionInfo") { var out MongoDbConnectionInfo if err := json.Unmarshal(input, &out); err != nil { return nil, fmt.Errorf("unmarshaling into MongoDbConnectionInfo: %+v", err) diff --git a/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go index 7fcca941b2c..c54f00935ed 100644 --- a/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/taskresource/model_mongodbconnectioninfo.go @@ -53,7 +53,7 @@ func (s MongoDbConnectionInfo) MarshalJSON() ([]byte, error) { return nil, fmt.Errorf("unmarshaling MongoDbConnectionInfo: %+v", err) } - decoded["type"] = "MongoDbConnectionInfo" + decoded["type"] = "mongoDbConnectionInfo" encoded, err = json.Marshal(decoded) if err != nil { diff --git a/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go index c9291fb2fab..793caeabedc 100644 --- a/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go @@ -138,6 +138,8 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -146,6 +148,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -168,6 +172,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go index 642ecd4a0bd..6f3a6c4f554 100644 --- a/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -217,6 +217,8 @@ func parseIsGlobal(input string) (*IsGlobal, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -225,6 +227,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -247,6 +251,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go b/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go index caa8b3c8747..9007e4a33df 100644 --- a/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go +++ b/resource-manager/network/2024-05-01/networkmanagereffectiveconnectivityconfiguration/constants.go @@ -217,6 +217,8 @@ func parseIsGlobal(input string) (*IsGlobal, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -225,6 +227,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -247,6 +251,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go b/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go index 67086d778e3..6dbd1e6db74 100644 --- a/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go +++ b/resource-manager/network/2024-05-01/networkmanagereffectivesecurityadminrules/constants.go @@ -138,6 +138,8 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -146,6 +148,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -168,6 +172,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2025-01-01/networkmanagereffectiveconnectivityconfiguration/constants.go b/resource-manager/network/2025-01-01/networkmanagereffectiveconnectivityconfiguration/constants.go index aa292723727..c5bc0377dcd 100644 --- a/resource-manager/network/2025-01-01/networkmanagereffectiveconnectivityconfiguration/constants.go +++ b/resource-manager/network/2025-01-01/networkmanagereffectiveconnectivityconfiguration/constants.go @@ -340,6 +340,8 @@ func parsePeeringEnforcement(input string) (*PeeringEnforcement, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -348,6 +350,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -370,6 +374,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2025-01-01/networkmanagereffectivesecurityadminrules/constants.go b/resource-manager/network/2025-01-01/networkmanagereffectivesecurityadminrules/constants.go index 67086d778e3..6dbd1e6db74 100644 --- a/resource-manager/network/2025-01-01/networkmanagereffectivesecurityadminrules/constants.go +++ b/resource-manager/network/2025-01-01/networkmanagereffectivesecurityadminrules/constants.go @@ -138,6 +138,8 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -146,6 +148,8 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -168,6 +172,8 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityrequest.go b/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_erroradditionalinfo.go similarity index 52% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityrequest.go rename to resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_erroradditionalinfo.go index a53efdc08c7..8e707921e70 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityrequest.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_erroradditionalinfo.go @@ -1,9 +1,9 @@ -package videoanalyzers +package protecteditems // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type CheckNameAvailabilityRequest struct { - Name *string `json:"name,omitempty"` - Type *string `json:"type,omitempty"` +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_errordetail.go index e3fa04c50a3..cbf15d6fb2c 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/protecteditems/model_errordetail.go @@ -4,7 +4,9 @@ package protecteditems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_erroradditionalinfo.go new file mode 100644 index 00000000000..f35071cbfae --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package backupprotectableitems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_errordetail.go index 1c3fd85652e..6a8923d264f 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_errordetail.go @@ -4,7 +4,9 @@ package backupprotectableitems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_erroradditionalinfo.go new file mode 100644 index 00000000000..587f9f9bc15 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package backupprotecteditems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go index c55cc388bf9..58e05ea4f02 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotecteditems/model_errordetail.go @@ -4,7 +4,9 @@ package backupprotecteditems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_erroradditionalinfo.go new file mode 100644 index 00000000000..6d8100b64e9 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package backupprotectioncontainers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go index 86008b3edcb..01bc67ec3f4 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go @@ -4,7 +4,9 @@ package backupprotectioncontainers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_erroradditionalinfo.go new file mode 100644 index 00000000000..9ab2947bdeb --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package operation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_errordetail.go index 2c609c87024..aed79a5ae3b 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_errordetail.go @@ -4,7 +4,9 @@ package operation // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go new file mode 100644 index 00000000000..8e707921e70 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package protecteditems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go index e3fa04c50a3..cbf15d6fb2c 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go @@ -4,7 +4,9 @@ package protecteditems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_erroradditionalinfo.go new file mode 100644 index 00000000000..8e24f9a7b12 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package protectioncontainers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_errordetail.go index 6eac856c404..44feb059e5d 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_errordetail.go @@ -4,7 +4,9 @@ package protectioncontainers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_erroradditionalinfo.go b/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_erroradditionalinfo.go new file mode 100644 index 00000000000..30f15bc8fa3 --- /dev/null +++ b/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_erroradditionalinfo.go @@ -0,0 +1,9 @@ +package softdeletedcontainers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ErrorAdditionalInfo struct { + Info *interface{} `json:"info,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_errordetail.go index b76617c0e57..017103a66c3 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_errordetail.go @@ -4,7 +4,9 @@ package softdeletedcontainers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - Code *string `json:"code,omitempty"` - Message *string `json:"message,omitempty"` - Recommendations *[]string `json:"recommendations,omitempty"` + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]ErrorDetail `json:"details,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` } diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/README.md b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/README.md new file mode 100644 index 00000000000..d39fd595c5c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments` Documentation + +The `accesspolicyassignments` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2025-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments" +``` + + +### Client Initialization + +```go +client := accesspolicyassignments.NewAccessPolicyAssignmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AccessPolicyAssignmentsClient.AccessPolicyAssignmentCreateUpdate` + +```go +ctx := context.TODO() +id := accesspolicyassignments.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +payload := accesspolicyassignments.AccessPolicyAssignment{ + // ... +} + + +if err := client.AccessPolicyAssignmentCreateUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccessPolicyAssignmentsClient.AccessPolicyAssignmentDelete` + +```go +ctx := context.TODO() +id := accesspolicyassignments.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +if err := client.AccessPolicyAssignmentDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `AccessPolicyAssignmentsClient.AccessPolicyAssignmentGet` + +```go +ctx := context.TODO() +id := accesspolicyassignments.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +read, err := client.AccessPolicyAssignmentGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccessPolicyAssignmentsClient.AccessPolicyAssignmentList` + +```go +ctx := context.TODO() +id := accesspolicyassignments.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +// alternatively `client.AccessPolicyAssignmentList(ctx, id)` can be used to do batched pagination +items, err := client.AccessPolicyAssignmentListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/client.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/client.go new file mode 100644 index 00000000000..7bfe69b6b81 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/client.go @@ -0,0 +1,26 @@ +package accesspolicyassignments + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentsClient struct { + Client *resourcemanager.Client +} + +func NewAccessPolicyAssignmentsClientWithBaseURI(sdkApi sdkEnv.Api) (*AccessPolicyAssignmentsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "accesspolicyassignments", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AccessPolicyAssignmentsClient: %+v", err) + } + + return &AccessPolicyAssignmentsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/constants.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/constants.go new file mode 100644 index 00000000000..fa67f195ba9 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/constants.go @@ -0,0 +1,63 @@ +package accesspolicyassignments + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_accesspolicyassignment.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_accesspolicyassignment.go new file mode 100644 index 00000000000..097227421ab --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_accesspolicyassignment.go @@ -0,0 +1,148 @@ +package accesspolicyassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccessPolicyAssignmentId{}) +} + +var _ resourceids.ResourceId = &AccessPolicyAssignmentId{} + +// AccessPolicyAssignmentId is a struct representing the Resource ID for a Access Policy Assignment +type AccessPolicyAssignmentId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string + AccessPolicyAssignmentName string +} + +// NewAccessPolicyAssignmentID returns a new AccessPolicyAssignmentId struct +func NewAccessPolicyAssignmentID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string, accessPolicyAssignmentName string) AccessPolicyAssignmentId { + return AccessPolicyAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, + AccessPolicyAssignmentName: accessPolicyAssignmentName, + } +} + +// ParseAccessPolicyAssignmentID parses 'input' into a AccessPolicyAssignmentId +func ParseAccessPolicyAssignmentID(input string) (*AccessPolicyAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessPolicyAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessPolicyAssignmentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccessPolicyAssignmentIDInsensitively parses 'input' case-insensitively into a AccessPolicyAssignmentId +// note: this method should only be used for API response data and not user input +func ParseAccessPolicyAssignmentIDInsensitively(input string) (*AccessPolicyAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessPolicyAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessPolicyAssignmentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) + } + + if id.AccessPolicyAssignmentName, ok = input.Parsed["accessPolicyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", input) + } + + return nil +} + +// ValidateAccessPolicyAssignmentID checks that 'input' can be parsed as a Access Policy Assignment ID +func ValidateAccessPolicyAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccessPolicyAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Access Policy Assignment ID +func (id AccessPolicyAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s/accessPolicyAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName, id.AccessPolicyAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Access Policy Assignment ID +func (id AccessPolicyAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseName"), + resourceids.StaticSegment("staticAccessPolicyAssignments", "accessPolicyAssignments", "accessPolicyAssignments"), + resourceids.UserSpecifiedSegment("accessPolicyAssignmentName", "accessPolicyAssignmentName"), + } +} + +// String returns a human-readable description of this Access Policy Assignment ID +func (id AccessPolicyAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Access Policy Assignment Name: %q", id.AccessPolicyAssignmentName), + } + return fmt.Sprintf("Access Policy Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_accesspolicyassignment_test.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_accesspolicyassignment_test.go new file mode 100644 index 00000000000..44c2ff8fc64 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_accesspolicyassignment_test.go @@ -0,0 +1,372 @@ +package accesspolicyassignments + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AccessPolicyAssignmentId{} + +func TestNewAccessPolicyAssignmentID(t *testing.T) { + id := NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") + } + + if id.DatabaseName != "databaseName" { + t.Fatalf("Expected %q but got %q for Segment 'DatabaseName'", id.DatabaseName, "databaseName") + } + + if id.AccessPolicyAssignmentName != "accessPolicyAssignmentName" { + t.Fatalf("Expected %q but got %q for Segment 'AccessPolicyAssignmentName'", id.AccessPolicyAssignmentName, "accessPolicyAssignmentName") + } +} + +func TestFormatAccessPolicyAssignmentID(t *testing.T) { + actual := NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccessPolicyAssignmentID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessPolicyAssignmentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", + AccessPolicyAssignmentName: "accessPolicyAssignmentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessPolicyAssignmentID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) + } + + if actual.AccessPolicyAssignmentName != v.Expected.AccessPolicyAssignmentName { + t.Fatalf("Expected %q but got %q for AccessPolicyAssignmentName", v.Expected.AccessPolicyAssignmentName, actual.AccessPolicyAssignmentName) + } + + } +} + +func TestParseAccessPolicyAssignmentIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessPolicyAssignmentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", + AccessPolicyAssignmentName: "accessPolicyAssignmentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs/aCcEsSpOlIcYaSsIgNmEnTnAmE", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + DatabaseName: "dAtAbAsEnAmE", + AccessPolicyAssignmentName: "aCcEsSpOlIcYaSsIgNmEnTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs/aCcEsSpOlIcYaSsIgNmEnTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessPolicyAssignmentIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) + } + + if actual.AccessPolicyAssignmentName != v.Expected.AccessPolicyAssignmentName { + t.Fatalf("Expected %q but got %q for AccessPolicyAssignmentName", v.Expected.AccessPolicyAssignmentName, actual.AccessPolicyAssignmentName) + } + + } +} + +func TestSegmentsForAccessPolicyAssignmentId(t *testing.T) { + segments := AccessPolicyAssignmentId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccessPolicyAssignmentId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_database.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_database.go new file mode 100644 index 00000000000..d76b33a6779 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_database.go @@ -0,0 +1,139 @@ +package accesspolicyassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DatabaseId{}) +} + +var _ resourceids.ResourceId = &DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) + } + + return nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseName"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy_test.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_database_test.go similarity index 60% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy_test.go rename to resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_database_test.go index fd8b4940c4a..850b9e7c2bd 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy_test.go +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/id_database_test.go @@ -1,4 +1,4 @@ -package videos +package accesspolicyassignments import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &AccessPolicyId{} +var _ resourceids.ResourceId = &DatabaseId{} -func TestNewAccessPolicyID(t *testing.T) { - id := NewAccessPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "accessPolicyName") +func TestNewDatabaseID(t *testing.T) { + id := NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,28 +22,28 @@ func TestNewAccessPolicyID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VideoAnalyzerName != "videoAnalyzerName" { - t.Fatalf("Expected %q but got %q for Segment 'VideoAnalyzerName'", id.VideoAnalyzerName, "videoAnalyzerName") + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") } - if id.AccessPolicyName != "accessPolicyName" { - t.Fatalf("Expected %q but got %q for Segment 'AccessPolicyName'", id.AccessPolicyName, "accessPolicyName") + if id.DatabaseName != "databaseName" { + t.Fatalf("Expected %q but got %q for Segment 'DatabaseName'", id.DatabaseName, "databaseName") } } -func TestFormatAccessPolicyID(t *testing.T) { - actual := NewAccessPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "accessPolicyName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/accessPolicies/accessPolicyName" +func TestFormatDatabaseID(t *testing.T) { + actual := NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseAccessPolicyID(t *testing.T) { +func TestParseDatabaseID(t *testing.T) { testData := []struct { Input string Error bool - Expected *AccessPolicyId + Expected *DatabaseId }{ { // Incomplete URI @@ -77,44 +77,44 @@ func TestParseAccessPolicyID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/accessPolicies", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/accessPolicies/accessPolicyName", - Expected: &AccessPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", - AccessPolicyName: "accessPolicyName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/accessPolicies/accessPolicyName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseAccessPolicyID(v.Input) + actual, err := ParseDatabaseID(v.Input) if err != nil { if v.Error { continue @@ -134,22 +134,22 @@ func TestParseAccessPolicyID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } - if actual.AccessPolicyName != v.Expected.AccessPolicyName { - t.Fatalf("Expected %q but got %q for AccessPolicyName", v.Expected.AccessPolicyName, actual.AccessPolicyName) + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) } } } -func TestParseAccessPolicyIDInsensitively(t *testing.T) { +func TestParseDatabaseIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *AccessPolicyId + Expected *DatabaseId }{ { // Incomplete URI @@ -208,79 +208,79 @@ func TestParseAccessPolicyIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/accessPolicies", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/aCcEsSpOlIcIeS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/accessPolicies/accessPolicyName", - Expected: &AccessPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", - AccessPolicyName: "accessPolicyName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/accessPolicies/accessPolicyName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/aCcEsSpOlIcIeS/aCcEsSpOlIcYnAmE", - Expected: &AccessPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VideoAnalyzerName: "vIdEoAnAlYzErNaMe", - AccessPolicyName: "aCcEsSpOlIcYnAmE", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + DatabaseName: "dAtAbAsEnAmE", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/aCcEsSpOlIcIeS/aCcEsSpOlIcYnAmE/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseAccessPolicyIDInsensitively(v.Input) + actual, err := ParseDatabaseIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -300,21 +300,21 @@ func TestParseAccessPolicyIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } - if actual.AccessPolicyName != v.Expected.AccessPolicyName { - t.Fatalf("Expected %q but got %q for AccessPolicyName", v.Expected.AccessPolicyName, actual.AccessPolicyName) + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) } } } -func TestSegmentsForAccessPolicyId(t *testing.T) { - segments := AccessPolicyId{}.Segments() +func TestSegmentsForDatabaseId(t *testing.T) { + segments := DatabaseId{}.Segments() if len(segments) == 0 { - t.Fatalf("AccessPolicyId has no segments") + t.Fatalf("DatabaseId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentcreateupdate.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentcreateupdate.go new file mode 100644 index 00000000000..f0e29140a9b --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentcreateupdate.go @@ -0,0 +1,75 @@ +package accesspolicyassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentCreateUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AccessPolicyAssignment +} + +// AccessPolicyAssignmentCreateUpdate ... +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentCreateUpdate(ctx context.Context, id AccessPolicyAssignmentId, input AccessPolicyAssignment) (result AccessPolicyAssignmentCreateUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AccessPolicyAssignmentCreateUpdateThenPoll performs AccessPolicyAssignmentCreateUpdate then polls until it's completed +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentCreateUpdateThenPoll(ctx context.Context, id AccessPolicyAssignmentId, input AccessPolicyAssignment) error { + result, err := c.AccessPolicyAssignmentCreateUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccessPolicyAssignmentCreateUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AccessPolicyAssignmentCreateUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentdelete.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentdelete.go new file mode 100644 index 00000000000..6115d04c9e1 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentdelete.go @@ -0,0 +1,70 @@ +package accesspolicyassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AccessPolicyAssignmentDelete ... +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentDelete(ctx context.Context, id AccessPolicyAssignmentId) (result AccessPolicyAssignmentDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AccessPolicyAssignmentDeleteThenPoll performs AccessPolicyAssignmentDelete then polls until it's completed +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentDeleteThenPoll(ctx context.Context, id AccessPolicyAssignmentId) error { + result, err := c.AccessPolicyAssignmentDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AccessPolicyAssignmentDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AccessPolicyAssignmentDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentget.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentget.go new file mode 100644 index 00000000000..92920238286 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentget.go @@ -0,0 +1,53 @@ +package accesspolicyassignments + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessPolicyAssignment +} + +// AccessPolicyAssignmentGet ... +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentGet(ctx context.Context, id AccessPolicyAssignmentId) (result AccessPolicyAssignmentGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AccessPolicyAssignment + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentlist.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentlist.go new file mode 100644 index 00000000000..638d5a7be88 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/method_accesspolicyassignmentlist.go @@ -0,0 +1,105 @@ +package accesspolicyassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AccessPolicyAssignment +} + +type AccessPolicyAssignmentListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AccessPolicyAssignment +} + +type AccessPolicyAssignmentListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *AccessPolicyAssignmentListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// AccessPolicyAssignmentList ... +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentList(ctx context.Context, id DatabaseId) (result AccessPolicyAssignmentListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &AccessPolicyAssignmentListCustomPager{}, + Path: fmt.Sprintf("%s/accessPolicyAssignments", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AccessPolicyAssignment `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// AccessPolicyAssignmentListComplete retrieves all the results into a single object +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentListComplete(ctx context.Context, id DatabaseId) (AccessPolicyAssignmentListCompleteResult, error) { + return c.AccessPolicyAssignmentListCompleteMatchingPredicate(ctx, id, AccessPolicyAssignmentOperationPredicate{}) +} + +// AccessPolicyAssignmentListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AccessPolicyAssignmentsClient) AccessPolicyAssignmentListCompleteMatchingPredicate(ctx context.Context, id DatabaseId, predicate AccessPolicyAssignmentOperationPredicate) (result AccessPolicyAssignmentListCompleteResult, err error) { + items := make([]AccessPolicyAssignment, 0) + + resp, err := c.AccessPolicyAssignmentList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = AccessPolicyAssignmentListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignment.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignment.go new file mode 100644 index 00000000000..6caa7fbc508 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignment.go @@ -0,0 +1,11 @@ +package accesspolicyassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignment struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccessPolicyAssignmentProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignmentproperties.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignmentproperties.go new file mode 100644 index 00000000000..4644bd967f5 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignmentproperties.go @@ -0,0 +1,10 @@ +package accesspolicyassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentProperties struct { + AccessPolicyName string `json:"accessPolicyName"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + User AccessPolicyAssignmentPropertiesUser `json:"user"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignmentpropertiesuser.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignmentpropertiesuser.go new file mode 100644 index 00000000000..59a7e360d4d --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignmentpropertiesuser.go @@ -0,0 +1,8 @@ +package accesspolicyassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentPropertiesUser struct { + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/predicates.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/predicates.go similarity index 72% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/predicates.go rename to resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/predicates.go index 5962467106d..5026f224768 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/predicates.go +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/predicates.go @@ -1,15 +1,15 @@ -package edgemodules +package accesspolicyassignments // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type EdgeModuleEntityOperationPredicate struct { +type AccessPolicyAssignmentOperationPredicate struct { Id *string Name *string Type *string } -func (p EdgeModuleEntityOperationPredicate) Matches(input EdgeModuleEntity) bool { +func (p AccessPolicyAssignmentOperationPredicate) Matches(input AccessPolicyAssignment) bool { if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/version.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/version.go new file mode 100644 index 00000000000..3b8dcc9012c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/version.go @@ -0,0 +1,10 @@ +package accesspolicyassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-07-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/accesspolicyassignments/2025-07-01" +} diff --git a/resource-manager/redisenterprise/2025-07-01/client.go b/resource-manager/redisenterprise/2025-07-01/client.go new file mode 100644 index 00000000000..f86b447b257 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/client.go @@ -0,0 +1,64 @@ +package v2025_07_01 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/databases" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/privateendpointconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/privatelinkresources" + "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/redisenterprise" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AccessPolicyAssignments *accesspolicyassignments.AccessPolicyAssignmentsClient + Databases *databases.DatabasesClient + PrivateEndpointConnections *privateendpointconnections.PrivateEndpointConnectionsClient + PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient + RedisEnterprise *redisenterprise.RedisEnterpriseClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + accessPolicyAssignmentsClient, err := accesspolicyassignments.NewAccessPolicyAssignmentsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AccessPolicyAssignments client: %+v", err) + } + configureFunc(accessPolicyAssignmentsClient.Client) + + databasesClient, err := databases.NewDatabasesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Databases client: %+v", err) + } + configureFunc(databasesClient.Client) + + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + configureFunc(privateEndpointConnectionsClient.Client) + + privateLinkResourcesClient, err := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateLinkResources client: %+v", err) + } + configureFunc(privateLinkResourcesClient.Client) + + redisEnterpriseClient, err := redisenterprise.NewRedisEnterpriseClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building RedisEnterprise client: %+v", err) + } + configureFunc(redisEnterpriseClient.Client) + + return &Client{ + AccessPolicyAssignments: accessPolicyAssignmentsClient, + Databases: databasesClient, + PrivateEndpointConnections: privateEndpointConnectionsClient, + PrivateLinkResources: privateLinkResourcesClient, + RedisEnterprise: redisEnterpriseClient, + }, nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/README.md b/resource-manager/redisenterprise/2025-07-01/databases/README.md new file mode 100644 index 00000000000..1e18a5be637 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/README.md @@ -0,0 +1,291 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/databases` Documentation + +The `databases` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2025-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/databases" +``` + + +### Client Initialization + +```go +client := databases.NewDatabasesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DatabasesClient.AccessPolicyAssignmentCreateUpdate` + +```go +ctx := context.TODO() +id := databases.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +payload := databases.AccessPolicyAssignment{ + // ... +} + + +if err := client.AccessPolicyAssignmentCreateUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.AccessPolicyAssignmentDelete` + +```go +ctx := context.TODO() +id := databases.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +if err := client.AccessPolicyAssignmentDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.AccessPolicyAssignmentGet` + +```go +ctx := context.TODO() +id := databases.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +read, err := client.AccessPolicyAssignmentGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.AccessPolicyAssignmentList` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +// alternatively `client.AccessPolicyAssignmentList(ctx, id)` can be used to do batched pagination +items, err := client.AccessPolicyAssignmentListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DatabasesClient.Create` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.Database{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Delete` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Export` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.ExportClusterParameters{ + // ... +} + + +if err := client.ExportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Flush` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.FlushParameters{ + // ... +} + + +if err := client.FlushThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.ForceLinkToReplicationGroup` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.ForceLinkParameters{ + // ... +} + + +if err := client.ForceLinkToReplicationGroupThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.ForceUnlink` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.ForceUnlinkParameters{ + // ... +} + + +if err := client.ForceUnlinkThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Get` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.Import` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.ImportClusterParameters{ + // ... +} + + +if err := client.ImportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.ListByCluster` + +```go +ctx := context.TODO() +id := databases.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +// alternatively `client.ListByCluster(ctx, id)` can be used to do batched pagination +items, err := client.ListByClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DatabasesClient.ListKeys` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +read, err := client.ListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DatabasesClient.RegenerateKey` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.RegenerateKeyParameters{ + // ... +} + + +if err := client.RegenerateKeyThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.Update` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := databases.DatabaseUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DatabasesClient.UpgradeDBRedisVersion` + +```go +ctx := context.TODO() +id := databases.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +if err := client.UpgradeDBRedisVersionThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/client.go b/resource-manager/redisenterprise/2025-07-01/databases/client.go similarity index 55% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/client.go rename to resource-manager/redisenterprise/2025-07-01/databases/client.go index 76fbe4aa4fa..87de2d4fe59 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/client.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/client.go @@ -1,4 +1,4 @@ -package videos +package databases import ( "fmt" @@ -10,17 +10,17 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideosClient struct { +type DatabasesClient struct { Client *resourcemanager.Client } -func NewVideosClientWithBaseURI(sdkApi sdkEnv.Api) (*VideosClient, error) { - client, err := resourcemanager.NewClient(sdkApi, "videos", defaultApiVersion) +func NewDatabasesClientWithBaseURI(sdkApi sdkEnv.Api) (*DatabasesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "databases", defaultApiVersion) if err != nil { - return nil, fmt.Errorf("instantiating VideosClient: %+v", err) + return nil, fmt.Errorf("instantiating DatabasesClient: %+v", err) } - return &VideosClient{ + return &DatabasesClient{ Client: client, }, nil } diff --git a/resource-manager/redisenterprise/2025-07-01/databases/constants.go b/resource-manager/redisenterprise/2025-07-01/databases/constants.go new file mode 100644 index 00000000000..9d47684b918 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/constants.go @@ -0,0 +1,545 @@ +package databases + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeyType string + +const ( + AccessKeyTypePrimary AccessKeyType = "Primary" + AccessKeyTypeSecondary AccessKeyType = "Secondary" +) + +func PossibleValuesForAccessKeyType() []string { + return []string{ + string(AccessKeyTypePrimary), + string(AccessKeyTypeSecondary), + } +} + +func (s *AccessKeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAccessKeyType(input string) (*AccessKeyType, error) { + vals := map[string]AccessKeyType{ + "primary": AccessKeyTypePrimary, + "secondary": AccessKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessKeyType(input) + return &out, nil +} + +type AccessKeysAuthentication string + +const ( + AccessKeysAuthenticationDisabled AccessKeysAuthentication = "Disabled" + AccessKeysAuthenticationEnabled AccessKeysAuthentication = "Enabled" +) + +func PossibleValuesForAccessKeysAuthentication() []string { + return []string{ + string(AccessKeysAuthenticationDisabled), + string(AccessKeysAuthenticationEnabled), + } +} + +func (s *AccessKeysAuthentication) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessKeysAuthentication(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAccessKeysAuthentication(input string) (*AccessKeysAuthentication, error) { + vals := map[string]AccessKeysAuthentication{ + "disabled": AccessKeysAuthenticationDisabled, + "enabled": AccessKeysAuthenticationEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessKeysAuthentication(input) + return &out, nil +} + +type AofFrequency string + +const ( + AofFrequencyAlways AofFrequency = "always" + AofFrequencyOnes AofFrequency = "1s" +) + +func PossibleValuesForAofFrequency() []string { + return []string{ + string(AofFrequencyAlways), + string(AofFrequencyOnes), + } +} + +func (s *AofFrequency) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAofFrequency(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAofFrequency(input string) (*AofFrequency, error) { + vals := map[string]AofFrequency{ + "always": AofFrequencyAlways, + "1s": AofFrequencyOnes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AofFrequency(input) + return &out, nil +} + +type ClusteringPolicy string + +const ( + ClusteringPolicyEnterpriseCluster ClusteringPolicy = "EnterpriseCluster" + ClusteringPolicyNoCluster ClusteringPolicy = "NoCluster" + ClusteringPolicyOSSCluster ClusteringPolicy = "OSSCluster" +) + +func PossibleValuesForClusteringPolicy() []string { + return []string{ + string(ClusteringPolicyEnterpriseCluster), + string(ClusteringPolicyNoCluster), + string(ClusteringPolicyOSSCluster), + } +} + +func (s *ClusteringPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusteringPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseClusteringPolicy(input string) (*ClusteringPolicy, error) { + vals := map[string]ClusteringPolicy{ + "enterprisecluster": ClusteringPolicyEnterpriseCluster, + "nocluster": ClusteringPolicyNoCluster, + "osscluster": ClusteringPolicyOSSCluster, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusteringPolicy(input) + return &out, nil +} + +type DeferUpgradeSetting string + +const ( + DeferUpgradeSettingDeferred DeferUpgradeSetting = "Deferred" + DeferUpgradeSettingNotDeferred DeferUpgradeSetting = "NotDeferred" +) + +func PossibleValuesForDeferUpgradeSetting() []string { + return []string{ + string(DeferUpgradeSettingDeferred), + string(DeferUpgradeSettingNotDeferred), + } +} + +func (s *DeferUpgradeSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeferUpgradeSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeferUpgradeSetting(input string) (*DeferUpgradeSetting, error) { + vals := map[string]DeferUpgradeSetting{ + "deferred": DeferUpgradeSettingDeferred, + "notdeferred": DeferUpgradeSettingNotDeferred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeferUpgradeSetting(input) + return &out, nil +} + +type EvictionPolicy string + +const ( + EvictionPolicyAllKeysLFU EvictionPolicy = "AllKeysLFU" + EvictionPolicyAllKeysLRU EvictionPolicy = "AllKeysLRU" + EvictionPolicyAllKeysRandom EvictionPolicy = "AllKeysRandom" + EvictionPolicyNoEviction EvictionPolicy = "NoEviction" + EvictionPolicyVolatileLFU EvictionPolicy = "VolatileLFU" + EvictionPolicyVolatileLRU EvictionPolicy = "VolatileLRU" + EvictionPolicyVolatileRandom EvictionPolicy = "VolatileRandom" + EvictionPolicyVolatileTTL EvictionPolicy = "VolatileTTL" +) + +func PossibleValuesForEvictionPolicy() []string { + return []string{ + string(EvictionPolicyAllKeysLFU), + string(EvictionPolicyAllKeysLRU), + string(EvictionPolicyAllKeysRandom), + string(EvictionPolicyNoEviction), + string(EvictionPolicyVolatileLFU), + string(EvictionPolicyVolatileLRU), + string(EvictionPolicyVolatileRandom), + string(EvictionPolicyVolatileTTL), + } +} + +func (s *EvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEvictionPolicy(input string) (*EvictionPolicy, error) { + vals := map[string]EvictionPolicy{ + "allkeyslfu": EvictionPolicyAllKeysLFU, + "allkeyslru": EvictionPolicyAllKeysLRU, + "allkeysrandom": EvictionPolicyAllKeysRandom, + "noeviction": EvictionPolicyNoEviction, + "volatilelfu": EvictionPolicyVolatileLFU, + "volatilelru": EvictionPolicyVolatileLRU, + "volatilerandom": EvictionPolicyVolatileRandom, + "volatilettl": EvictionPolicyVolatileTTL, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EvictionPolicy(input) + return &out, nil +} + +type LinkState string + +const ( + LinkStateLinkFailed LinkState = "LinkFailed" + LinkStateLinked LinkState = "Linked" + LinkStateLinking LinkState = "Linking" + LinkStateUnlinkFailed LinkState = "UnlinkFailed" + LinkStateUnlinking LinkState = "Unlinking" +) + +func PossibleValuesForLinkState() []string { + return []string{ + string(LinkStateLinkFailed), + string(LinkStateLinked), + string(LinkStateLinking), + string(LinkStateUnlinkFailed), + string(LinkStateUnlinking), + } +} + +func (s *LinkState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinkState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinkState(input string) (*LinkState, error) { + vals := map[string]LinkState{ + "linkfailed": LinkStateLinkFailed, + "linked": LinkStateLinked, + "linking": LinkStateLinking, + "unlinkfailed": LinkStateUnlinkFailed, + "unlinking": LinkStateUnlinking, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinkState(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolEncrypted Protocol = "Encrypted" + ProtocolPlaintext Protocol = "Plaintext" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolEncrypted), + string(ProtocolPlaintext), + } +} + +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "encrypted": ProtocolEncrypted, + "plaintext": ProtocolPlaintext, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type RdbFrequency string + +const ( + RdbFrequencyOneTwoh RdbFrequency = "12h" + RdbFrequencyOneh RdbFrequency = "1h" + RdbFrequencySixh RdbFrequency = "6h" +) + +func PossibleValuesForRdbFrequency() []string { + return []string{ + string(RdbFrequencyOneTwoh), + string(RdbFrequencyOneh), + string(RdbFrequencySixh), + } +} + +func (s *RdbFrequency) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRdbFrequency(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRdbFrequency(input string) (*RdbFrequency, error) { + vals := map[string]RdbFrequency{ + "12h": RdbFrequencyOneTwoh, + "1h": RdbFrequencyOneh, + "6h": RdbFrequencySixh, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RdbFrequency(input) + return &out, nil +} + +type ResourceState string + +const ( + ResourceStateCreateFailed ResourceState = "CreateFailed" + ResourceStateCreating ResourceState = "Creating" + ResourceStateDeleteFailed ResourceState = "DeleteFailed" + ResourceStateDeleting ResourceState = "Deleting" + ResourceStateDisableFailed ResourceState = "DisableFailed" + ResourceStateDisabled ResourceState = "Disabled" + ResourceStateDisabling ResourceState = "Disabling" + ResourceStateEnableFailed ResourceState = "EnableFailed" + ResourceStateEnabling ResourceState = "Enabling" + ResourceStateMoving ResourceState = "Moving" + ResourceStateRunning ResourceState = "Running" + ResourceStateScaling ResourceState = "Scaling" + ResourceStateScalingFailed ResourceState = "ScalingFailed" + ResourceStateUpdateFailed ResourceState = "UpdateFailed" + ResourceStateUpdating ResourceState = "Updating" +) + +func PossibleValuesForResourceState() []string { + return []string{ + string(ResourceStateCreateFailed), + string(ResourceStateCreating), + string(ResourceStateDeleteFailed), + string(ResourceStateDeleting), + string(ResourceStateDisableFailed), + string(ResourceStateDisabled), + string(ResourceStateDisabling), + string(ResourceStateEnableFailed), + string(ResourceStateEnabling), + string(ResourceStateMoving), + string(ResourceStateRunning), + string(ResourceStateScaling), + string(ResourceStateScalingFailed), + string(ResourceStateUpdateFailed), + string(ResourceStateUpdating), + } +} + +func (s *ResourceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceState(input string) (*ResourceState, error) { + vals := map[string]ResourceState{ + "createfailed": ResourceStateCreateFailed, + "creating": ResourceStateCreating, + "deletefailed": ResourceStateDeleteFailed, + "deleting": ResourceStateDeleting, + "disablefailed": ResourceStateDisableFailed, + "disabled": ResourceStateDisabled, + "disabling": ResourceStateDisabling, + "enablefailed": ResourceStateEnableFailed, + "enabling": ResourceStateEnabling, + "moving": ResourceStateMoving, + "running": ResourceStateRunning, + "scaling": ResourceStateScaling, + "scalingfailed": ResourceStateScalingFailed, + "updatefailed": ResourceStateUpdateFailed, + "updating": ResourceStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceState(input) + return &out, nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/id_accesspolicyassignment.go b/resource-manager/redisenterprise/2025-07-01/databases/id_accesspolicyassignment.go new file mode 100644 index 00000000000..af2f6cb8882 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/id_accesspolicyassignment.go @@ -0,0 +1,148 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccessPolicyAssignmentId{}) +} + +var _ resourceids.ResourceId = &AccessPolicyAssignmentId{} + +// AccessPolicyAssignmentId is a struct representing the Resource ID for a Access Policy Assignment +type AccessPolicyAssignmentId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string + AccessPolicyAssignmentName string +} + +// NewAccessPolicyAssignmentID returns a new AccessPolicyAssignmentId struct +func NewAccessPolicyAssignmentID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string, accessPolicyAssignmentName string) AccessPolicyAssignmentId { + return AccessPolicyAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, + AccessPolicyAssignmentName: accessPolicyAssignmentName, + } +} + +// ParseAccessPolicyAssignmentID parses 'input' into a AccessPolicyAssignmentId +func ParseAccessPolicyAssignmentID(input string) (*AccessPolicyAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessPolicyAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessPolicyAssignmentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccessPolicyAssignmentIDInsensitively parses 'input' case-insensitively into a AccessPolicyAssignmentId +// note: this method should only be used for API response data and not user input +func ParseAccessPolicyAssignmentIDInsensitively(input string) (*AccessPolicyAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessPolicyAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessPolicyAssignmentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) + } + + if id.AccessPolicyAssignmentName, ok = input.Parsed["accessPolicyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", input) + } + + return nil +} + +// ValidateAccessPolicyAssignmentID checks that 'input' can be parsed as a Access Policy Assignment ID +func ValidateAccessPolicyAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccessPolicyAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Access Policy Assignment ID +func (id AccessPolicyAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s/accessPolicyAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName, id.AccessPolicyAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Access Policy Assignment ID +func (id AccessPolicyAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseName"), + resourceids.StaticSegment("staticAccessPolicyAssignments", "accessPolicyAssignments", "accessPolicyAssignments"), + resourceids.UserSpecifiedSegment("accessPolicyAssignmentName", "accessPolicyAssignmentName"), + } +} + +// String returns a human-readable description of this Access Policy Assignment ID +func (id AccessPolicyAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Access Policy Assignment Name: %q", id.AccessPolicyAssignmentName), + } + return fmt.Sprintf("Access Policy Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/id_accesspolicyassignment_test.go b/resource-manager/redisenterprise/2025-07-01/databases/id_accesspolicyassignment_test.go new file mode 100644 index 00000000000..5764612c5fc --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/id_accesspolicyassignment_test.go @@ -0,0 +1,372 @@ +package databases + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AccessPolicyAssignmentId{} + +func TestNewAccessPolicyAssignmentID(t *testing.T) { + id := NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") + } + + if id.DatabaseName != "databaseName" { + t.Fatalf("Expected %q but got %q for Segment 'DatabaseName'", id.DatabaseName, "databaseName") + } + + if id.AccessPolicyAssignmentName != "accessPolicyAssignmentName" { + t.Fatalf("Expected %q but got %q for Segment 'AccessPolicyAssignmentName'", id.AccessPolicyAssignmentName, "accessPolicyAssignmentName") + } +} + +func TestFormatAccessPolicyAssignmentID(t *testing.T) { + actual := NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccessPolicyAssignmentID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessPolicyAssignmentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", + AccessPolicyAssignmentName: "accessPolicyAssignmentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessPolicyAssignmentID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) + } + + if actual.AccessPolicyAssignmentName != v.Expected.AccessPolicyAssignmentName { + t.Fatalf("Expected %q but got %q for AccessPolicyAssignmentName", v.Expected.AccessPolicyAssignmentName, actual.AccessPolicyAssignmentName) + } + + } +} + +func TestParseAccessPolicyAssignmentIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessPolicyAssignmentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", + AccessPolicyAssignmentName: "accessPolicyAssignmentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs/aCcEsSpOlIcYaSsIgNmEnTnAmE", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + DatabaseName: "dAtAbAsEnAmE", + AccessPolicyAssignmentName: "aCcEsSpOlIcYaSsIgNmEnTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs/aCcEsSpOlIcYaSsIgNmEnTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessPolicyAssignmentIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) + } + + if actual.AccessPolicyAssignmentName != v.Expected.AccessPolicyAssignmentName { + t.Fatalf("Expected %q but got %q for AccessPolicyAssignmentName", v.Expected.AccessPolicyAssignmentName, actual.AccessPolicyAssignmentName) + } + + } +} + +func TestSegmentsForAccessPolicyAssignmentId(t *testing.T) { + segments := AccessPolicyAssignmentId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccessPolicyAssignmentId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/id_database.go b/resource-manager/redisenterprise/2025-07-01/databases/id_database.go new file mode 100644 index 00000000000..c2402902641 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/id_database.go @@ -0,0 +1,139 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DatabaseId{}) +} + +var _ resourceids.ResourceId = &DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) + } + + return nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseName"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video_test.go b/resource-manager/redisenterprise/2025-07-01/databases/id_database_test.go similarity index 61% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video_test.go rename to resource-manager/redisenterprise/2025-07-01/databases/id_database_test.go index da971470f3e..5dbc49dabaf 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video_test.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/id_database_test.go @@ -1,4 +1,4 @@ -package videos +package databases import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VideoId{} +var _ resourceids.ResourceId = &DatabaseId{} -func TestNewVideoID(t *testing.T) { - id := NewVideoID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "videoName") +func TestNewDatabaseID(t *testing.T) { + id := NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,28 +22,28 @@ func TestNewVideoID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VideoAnalyzerName != "videoAnalyzerName" { - t.Fatalf("Expected %q but got %q for Segment 'VideoAnalyzerName'", id.VideoAnalyzerName, "videoAnalyzerName") + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") } - if id.VideoName != "videoName" { - t.Fatalf("Expected %q but got %q for Segment 'VideoName'", id.VideoName, "videoName") + if id.DatabaseName != "databaseName" { + t.Fatalf("Expected %q but got %q for Segment 'DatabaseName'", id.DatabaseName, "databaseName") } } -func TestFormatVideoID(t *testing.T) { - actual := NewVideoID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "videoName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/videos/videoName" +func TestFormatDatabaseID(t *testing.T) { + actual := NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVideoID(t *testing.T) { +func TestParseDatabaseID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoId + Expected *DatabaseId }{ { // Incomplete URI @@ -77,44 +77,44 @@ func TestParseVideoID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/videos", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/videos/videoName", - Expected: &VideoId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", - VideoName: "videoName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/videos/videoName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoID(v.Input) + actual, err := ParseDatabaseID(v.Input) if err != nil { if v.Error { continue @@ -134,22 +134,22 @@ func TestParseVideoID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } - if actual.VideoName != v.Expected.VideoName { - t.Fatalf("Expected %q but got %q for VideoName", v.Expected.VideoName, actual.VideoName) + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) } } } -func TestParseVideoIDInsensitively(t *testing.T) { +func TestParseDatabaseIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoId + Expected *DatabaseId }{ { // Incomplete URI @@ -208,79 +208,79 @@ func TestParseVideoIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/videos", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/vIdEoS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/videos/videoName", - Expected: &VideoId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", - VideoName: "videoName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/videos/videoName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/vIdEoS/vIdEoNaMe", - Expected: &VideoId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VideoAnalyzerName: "vIdEoAnAlYzErNaMe", - VideoName: "vIdEoNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + DatabaseName: "dAtAbAsEnAmE", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/vIdEoS/vIdEoNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoIDInsensitively(v.Input) + actual, err := ParseDatabaseIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -300,21 +300,21 @@ func TestParseVideoIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } - if actual.VideoName != v.Expected.VideoName { - t.Fatalf("Expected %q but got %q for VideoName", v.Expected.VideoName, actual.VideoName) + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) } } } -func TestSegmentsForVideoId(t *testing.T) { - segments := VideoId{}.Segments() +func TestSegmentsForDatabaseId(t *testing.T) { + segments := DatabaseId{}.Segments() if len(segments) == 0 { - t.Fatalf("VideoId has no segments") + t.Fatalf("DatabaseId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/redisenterprise/2025-07-01/databases/id_redisenterprise.go b/resource-manager/redisenterprise/2025-07-01/databases/id_redisenterprise.go new file mode 100644 index 00000000000..c872e92eb24 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/id_redisenterprise.go @@ -0,0 +1,130 @@ +package databases + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&RedisEnterpriseId{}) +} + +var _ resourceids.ResourceId = &RedisEnterpriseId{} + +// RedisEnterpriseId is a struct representing the Resource ID for a Redis Enterprise +type RedisEnterpriseId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string +} + +// NewRedisEnterpriseID returns a new RedisEnterpriseId struct +func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string) RedisEnterpriseId { + return RedisEnterpriseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + } +} + +// ParseRedisEnterpriseID parses 'input' into a RedisEnterpriseId +func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRedisEnterpriseIDInsensitively parses 'input' case-insensitively into a RedisEnterpriseId +// note: this method should only be used for API response data and not user input +func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RedisEnterpriseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + return nil +} + +// ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID +func ValidateRedisEnterpriseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRedisEnterpriseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redis Enterprise ID +func (id RedisEnterpriseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redis Enterprise ID +func (id RedisEnterpriseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + } +} + +// String returns a human-readable description of this Redis Enterprise ID +func (id RedisEnterpriseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + } + return fmt.Sprintf("Redis Enterprise (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer_test.go b/resource-manager/redisenterprise/2025-07-01/databases/id_redisenterprise_test.go similarity index 66% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer_test.go rename to resource-manager/redisenterprise/2025-07-01/databases/id_redisenterprise_test.go index 30b0ec2413b..06c2b187531 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer_test.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/id_redisenterprise_test.go @@ -1,4 +1,4 @@ -package videos +package databases import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VideoAnalyzerId{} +var _ resourceids.ResourceId = &RedisEnterpriseId{} -func TestNewVideoAnalyzerID(t *testing.T) { - id := NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") +func TestNewRedisEnterpriseID(t *testing.T) { + id := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,24 +22,24 @@ func TestNewVideoAnalyzerID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VideoAnalyzerName != "videoAnalyzerName" { - t.Fatalf("Expected %q but got %q for Segment 'VideoAnalyzerName'", id.VideoAnalyzerName, "videoAnalyzerName") + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") } } -func TestFormatVideoAnalyzerID(t *testing.T) { - actual := NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName" +func TestFormatRedisEnterpriseID(t *testing.T) { + actual := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVideoAnalyzerID(t *testing.T) { +func TestParseRedisEnterpriseID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoAnalyzerId + Expected *RedisEnterpriseId }{ { // Incomplete URI @@ -73,33 +73,33 @@ func TestParseVideoAnalyzerID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoAnalyzerID(v.Input) + actual, err := ParseRedisEnterpriseID(v.Input) if err != nil { if v.Error { continue @@ -119,18 +119,18 @@ func TestParseVideoAnalyzerID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } } } -func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { +func TestParseRedisEnterpriseIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoAnalyzerId + Expected *RedisEnterpriseId }{ { // Incomplete URI @@ -189,57 +189,57 @@ func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VideoAnalyzerName: "vIdEoAnAlYzErNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoAnalyzerIDInsensitively(v.Input) + actual, err := ParseRedisEnterpriseIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -259,17 +259,17 @@ func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } } } -func TestSegmentsForVideoAnalyzerId(t *testing.T) { - segments := VideoAnalyzerId{}.Segments() +func TestSegmentsForRedisEnterpriseId(t *testing.T) { + segments := RedisEnterpriseId{}.Segments() if len(segments) == 0 { - t.Fatalf("VideoAnalyzerId has no segments") + t.Fatalf("RedisEnterpriseId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentcreateupdate.go b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentcreateupdate.go new file mode 100644 index 00000000000..b5d2ec870e5 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentcreateupdate.go @@ -0,0 +1,75 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentCreateUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AccessPolicyAssignment +} + +// AccessPolicyAssignmentCreateUpdate ... +func (c DatabasesClient) AccessPolicyAssignmentCreateUpdate(ctx context.Context, id AccessPolicyAssignmentId, input AccessPolicyAssignment) (result AccessPolicyAssignmentCreateUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AccessPolicyAssignmentCreateUpdateThenPoll performs AccessPolicyAssignmentCreateUpdate then polls until it's completed +func (c DatabasesClient) AccessPolicyAssignmentCreateUpdateThenPoll(ctx context.Context, id AccessPolicyAssignmentId, input AccessPolicyAssignment) error { + result, err := c.AccessPolicyAssignmentCreateUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccessPolicyAssignmentCreateUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AccessPolicyAssignmentCreateUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentdelete.go b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentdelete.go new file mode 100644 index 00000000000..0913889e6ad --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentdelete.go @@ -0,0 +1,70 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AccessPolicyAssignmentDelete ... +func (c DatabasesClient) AccessPolicyAssignmentDelete(ctx context.Context, id AccessPolicyAssignmentId) (result AccessPolicyAssignmentDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AccessPolicyAssignmentDeleteThenPoll performs AccessPolicyAssignmentDelete then polls until it's completed +func (c DatabasesClient) AccessPolicyAssignmentDeleteThenPoll(ctx context.Context, id AccessPolicyAssignmentId) error { + result, err := c.AccessPolicyAssignmentDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AccessPolicyAssignmentDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AccessPolicyAssignmentDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentget.go b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentget.go new file mode 100644 index 00000000000..fc7610ea931 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentget.go @@ -0,0 +1,53 @@ +package databases + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessPolicyAssignment +} + +// AccessPolicyAssignmentGet ... +func (c DatabasesClient) AccessPolicyAssignmentGet(ctx context.Context, id AccessPolicyAssignmentId) (result AccessPolicyAssignmentGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AccessPolicyAssignment + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentlist.go b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentlist.go new file mode 100644 index 00000000000..240ba0cbedf --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_accesspolicyassignmentlist.go @@ -0,0 +1,105 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AccessPolicyAssignment +} + +type AccessPolicyAssignmentListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AccessPolicyAssignment +} + +type AccessPolicyAssignmentListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *AccessPolicyAssignmentListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// AccessPolicyAssignmentList ... +func (c DatabasesClient) AccessPolicyAssignmentList(ctx context.Context, id DatabaseId) (result AccessPolicyAssignmentListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &AccessPolicyAssignmentListCustomPager{}, + Path: fmt.Sprintf("%s/accessPolicyAssignments", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AccessPolicyAssignment `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// AccessPolicyAssignmentListComplete retrieves all the results into a single object +func (c DatabasesClient) AccessPolicyAssignmentListComplete(ctx context.Context, id DatabaseId) (AccessPolicyAssignmentListCompleteResult, error) { + return c.AccessPolicyAssignmentListCompleteMatchingPredicate(ctx, id, AccessPolicyAssignmentOperationPredicate{}) +} + +// AccessPolicyAssignmentListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DatabasesClient) AccessPolicyAssignmentListCompleteMatchingPredicate(ctx context.Context, id DatabaseId, predicate AccessPolicyAssignmentOperationPredicate) (result AccessPolicyAssignmentListCompleteResult, err error) { + items := make([]AccessPolicyAssignment, 0) + + resp, err := c.AccessPolicyAssignmentList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = AccessPolicyAssignmentListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videoscreateorupdate.go b/resource-manager/redisenterprise/2025-07-01/databases/method_create.go similarity index 50% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videoscreateorupdate.go rename to resource-manager/redisenterprise/2025-07-01/databases/method_create.go index 9609a899989..ef7027e79c5 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videoscreateorupdate.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_create.go @@ -1,24 +1,28 @@ -package videos +package databases import ( "context" + "fmt" "net/http" "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/go-azure-sdk/sdk/odata" ) // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideosCreateOrUpdateOperationResponse struct { +type CreateOperationResponse struct { + Poller pollers.Poller HttpResponse *http.Response OData *odata.OData - Model *VideoEntity + Model *Database } -// VideosCreateOrUpdate ... -func (c VideosClient) VideosCreateOrUpdate(ctx context.Context, id VideoId, input VideoEntity) (result VideosCreateOrUpdateOperationResponse, err error) { +// Create ... +func (c DatabasesClient) Create(ctx context.Context, id DatabaseId, input Database) (result CreateOperationResponse, err error) { opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ @@ -48,11 +52,24 @@ func (c VideosClient) VideosCreateOrUpdate(ctx context.Context, id VideoId, inpu return } - var model VideoEntity - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { return } return } + +// CreateThenPoll performs Create then polls until it's completed +func (c DatabasesClient) CreateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_delete.go b/resource-manager/redisenterprise/2025-07-01/databases/method_delete.go similarity index 52% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_delete.go rename to resource-manager/redisenterprise/2025-07-01/databases/method_delete.go index 9444373021d..dc03e526611 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_delete.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_delete.go @@ -1,10 +1,13 @@ -package edgemodules +package databases import ( "context" + "fmt" "net/http" "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/go-azure-sdk/sdk/odata" ) @@ -12,15 +15,17 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type DeleteOperationResponse struct { + Poller pollers.Poller HttpResponse *http.Response OData *odata.OData } // Delete ... -func (c EdgeModulesClient) Delete(ctx context.Context, id EdgeModuleId) (result DeleteOperationResponse, err error) { +func (c DatabasesClient) Delete(ctx context.Context, id DatabaseId) (result DeleteOperationResponse, err error) { opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ + http.StatusAccepted, http.StatusNoContent, http.StatusOK, }, @@ -43,5 +48,24 @@ func (c EdgeModulesClient) Delete(ctx context.Context, id EdgeModuleId) (result return } + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + return } + +// DeleteThenPoll performs Delete then polls until it's completed +func (c DatabasesClient) DeleteThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_export.go b/resource-manager/redisenterprise/2025-07-01/databases/method_export.go new file mode 100644 index 00000000000..a35c1aaff53 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_export.go @@ -0,0 +1,74 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Export ... +func (c DatabasesClient) Export(ctx context.Context, id DatabaseId, input ExportClusterParameters) (result ExportOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/export", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ExportThenPoll performs Export then polls until it's completed +func (c DatabasesClient) ExportThenPoll(ctx context.Context, id DatabaseId, input ExportClusterParameters) error { + result, err := c.Export(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Export: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Export: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_flush.go b/resource-manager/redisenterprise/2025-07-01/databases/method_flush.go new file mode 100644 index 00000000000..aaf7666fdf0 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_flush.go @@ -0,0 +1,74 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlushOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Flush ... +func (c DatabasesClient) Flush(ctx context.Context, id DatabaseId, input FlushParameters) (result FlushOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/flush", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// FlushThenPoll performs Flush then polls until it's completed +func (c DatabasesClient) FlushThenPoll(ctx context.Context, id DatabaseId, input FlushParameters) error { + result, err := c.Flush(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Flush: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Flush: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_forcelinktoreplicationgroup.go b/resource-manager/redisenterprise/2025-07-01/databases/method_forcelinktoreplicationgroup.go new file mode 100644 index 00000000000..020c282d01d --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_forcelinktoreplicationgroup.go @@ -0,0 +1,73 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceLinkToReplicationGroupOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ForceLinkToReplicationGroup ... +func (c DatabasesClient) ForceLinkToReplicationGroup(ctx context.Context, id DatabaseId, input ForceLinkParameters) (result ForceLinkToReplicationGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/forceLinkToReplicationGroup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ForceLinkToReplicationGroupThenPoll performs ForceLinkToReplicationGroup then polls until it's completed +func (c DatabasesClient) ForceLinkToReplicationGroupThenPoll(ctx context.Context, id DatabaseId, input ForceLinkParameters) error { + result, err := c.ForceLinkToReplicationGroup(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ForceLinkToReplicationGroup: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ForceLinkToReplicationGroup: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_forceunlink.go b/resource-manager/redisenterprise/2025-07-01/databases/method_forceunlink.go new file mode 100644 index 00000000000..bc8f9b988c8 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_forceunlink.go @@ -0,0 +1,74 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceUnlinkOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ForceUnlink ... +func (c DatabasesClient) ForceUnlink(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) (result ForceUnlinkOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/forceUnlink", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ForceUnlinkThenPoll performs ForceUnlink then polls until it's completed +func (c DatabasesClient) ForceUnlinkThenPoll(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) error { + result, err := c.ForceUnlink(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ForceUnlink: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ForceUnlink: %+v", err) + } + + return nil +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_get.go b/resource-manager/redisenterprise/2025-07-01/databases/method_get.go similarity index 82% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_get.go rename to resource-manager/redisenterprise/2025-07-01/databases/method_get.go index 0674f360762..df1a873b818 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_get.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_get.go @@ -1,4 +1,4 @@ -package edgemodules +package databases import ( "context" @@ -14,11 +14,11 @@ import ( type GetOperationResponse struct { HttpResponse *http.Response OData *odata.OData - Model *EdgeModuleEntity + Model *Database } // Get ... -func (c EdgeModulesClient) Get(ctx context.Context, id EdgeModuleId) (result GetOperationResponse, err error) { +func (c DatabasesClient) Get(ctx context.Context, id DatabaseId) (result GetOperationResponse, err error) { opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ @@ -43,7 +43,7 @@ func (c EdgeModulesClient) Get(ctx context.Context, id EdgeModuleId) (result Get return } - var model EdgeModuleEntity + var model Database result.Model = &model if err = resp.Unmarshal(result.Model); err != nil { return diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_import.go b/resource-manager/redisenterprise/2025-07-01/databases/method_import.go new file mode 100644 index 00000000000..39022d59c43 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_import.go @@ -0,0 +1,74 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Import ... +func (c DatabasesClient) Import(ctx context.Context, id DatabaseId, input ImportClusterParameters) (result ImportOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/import", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// ImportThenPoll performs Import then polls until it's completed +func (c DatabasesClient) ImportThenPoll(ctx context.Context, id DatabaseId, input ImportClusterParameters) error { + result, err := c.Import(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Import: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Import: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_listbycluster.go b/resource-manager/redisenterprise/2025-07-01/databases/method_listbycluster.go new file mode 100644 index 00000000000..c98456fed45 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_listbycluster.go @@ -0,0 +1,105 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Database +} + +type ListByClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []Database +} + +type ListByClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByCluster ... +func (c DatabasesClient) ListByCluster(ctx context.Context, id RedisEnterpriseId) (result ListByClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByClusterCustomPager{}, + Path: fmt.Sprintf("%s/databases", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Database `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByClusterComplete retrieves all the results into a single object +func (c DatabasesClient) ListByClusterComplete(ctx context.Context, id RedisEnterpriseId) (ListByClusterCompleteResult, error) { + return c.ListByClusterCompleteMatchingPredicate(ctx, id, DatabaseOperationPredicate{}) +} + +// ListByClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DatabasesClient) ListByClusterCompleteMatchingPredicate(ctx context.Context, id RedisEnterpriseId, predicate DatabaseOperationPredicate) (result ListByClusterCompleteResult, err error) { + items := make([]Database, 0) + + resp, err := c.ListByCluster(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_listkeys.go b/resource-manager/redisenterprise/2025-07-01/databases/method_listkeys.go new file mode 100644 index 00000000000..147674d8dcf --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_listkeys.go @@ -0,0 +1,54 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListKeysOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessKeys +} + +// ListKeys ... +func (c DatabasesClient) ListKeys(ctx context.Context, id DatabaseId) (result ListKeysOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listKeys", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AccessKeys + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_regeneratekey.go b/resource-manager/redisenterprise/2025-07-01/databases/method_regeneratekey.go new file mode 100644 index 00000000000..f745c705aba --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_regeneratekey.go @@ -0,0 +1,75 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AccessKeys +} + +// RegenerateKey ... +func (c DatabasesClient) RegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (result RegenerateKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// RegenerateKeyThenPoll performs RegenerateKey then polls until it's completed +func (c DatabasesClient) RegenerateKeyThenPoll(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) error { + result, err := c.RegenerateKey(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RegenerateKey: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RegenerateKey: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_update.go b/resource-manager/redisenterprise/2025-07-01/databases/method_update.go new file mode 100644 index 00000000000..21a9006463c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_update.go @@ -0,0 +1,75 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Database +} + +// Update ... +func (c DatabasesClient) Update(ctx context.Context, id DatabaseId, input DatabaseUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c DatabasesClient) UpdateThenPoll(ctx context.Context, id DatabaseId, input DatabaseUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/method_upgradedbredisversion.go b/resource-manager/redisenterprise/2025-07-01/databases/method_upgradedbredisversion.go new file mode 100644 index 00000000000..ad7e756b1dc --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/method_upgradedbredisversion.go @@ -0,0 +1,69 @@ +package databases + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeDBRedisVersionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UpgradeDBRedisVersion ... +func (c DatabasesClient) UpgradeDBRedisVersion(ctx context.Context, id DatabaseId) (result UpgradeDBRedisVersionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgradeDBRedisVersion", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpgradeDBRedisVersionThenPoll performs UpgradeDBRedisVersion then polls until it's completed +func (c DatabasesClient) UpgradeDBRedisVersionThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.UpgradeDBRedisVersion(ctx, id) + if err != nil { + return fmt.Errorf("performing UpgradeDBRedisVersion: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpgradeDBRedisVersion: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_accesskeys.go b/resource-manager/redisenterprise/2025-07-01/databases/model_accesskeys.go new file mode 100644 index 00000000000..d2c730f7d54 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_accesskeys.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignment.go b/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignment.go new file mode 100644 index 00000000000..fd4718ad413 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignment.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignment struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccessPolicyAssignmentProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignmentproperties.go b/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignmentproperties.go new file mode 100644 index 00000000000..3994edd04fb --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignmentproperties.go @@ -0,0 +1,10 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentProperties struct { + AccessPolicyName string `json:"accessPolicyName"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + User AccessPolicyAssignmentPropertiesUser `json:"user"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleproperties.go b/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignmentpropertiesuser.go similarity index 58% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleproperties.go rename to resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignmentpropertiesuser.go index dd298c382ab..234cc2ca236 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleproperties.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignmentpropertiesuser.go @@ -1,8 +1,8 @@ -package edgemodules +package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type EdgeModuleProperties struct { - EdgeModuleId *string `json:"edgeModuleId,omitempty"` +type AccessPolicyAssignmentPropertiesUser struct { + ObjectId *string `json:"objectId,omitempty"` } diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_database.go b/resource-manager/redisenterprise/2025-07-01/databases/model_database.go new file mode 100644 index 00000000000..0cdd07cc118 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_database.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseCreateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_databasecommonpropertiesgeoreplication.go b/resource-manager/redisenterprise/2025-07-01/databases/model_databasecommonpropertiesgeoreplication.go new file mode 100644 index 00000000000..275e5952036 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_databasecommonpropertiesgeoreplication.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseCommonPropertiesGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_databasecreateproperties.go b/resource-manager/redisenterprise/2025-07-01/databases/model_databasecreateproperties.go new file mode 100644 index 00000000000..41eb7f38af7 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_databasecreateproperties.go @@ -0,0 +1,19 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseCreateProperties struct { + AccessKeysAuthentication *AccessKeysAuthentication `json:"accessKeysAuthentication,omitempty"` + ClientProtocol *Protocol `json:"clientProtocol,omitempty"` + ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + DeferUpgrade *DeferUpgradeSetting `json:"deferUpgrade,omitempty"` + EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` + GeoReplication *DatabaseCommonPropertiesGeoReplication `json:"geoReplication,omitempty"` + Modules *[]Module `json:"modules,omitempty"` + Persistence *Persistence `json:"persistence,omitempty"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_resourceidentity.go b/resource-manager/redisenterprise/2025-07-01/databases/model_databaseupdate.go similarity index 58% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_resourceidentity.go rename to resource-manager/redisenterprise/2025-07-01/databases/model_databaseupdate.go index a5a1ef99e41..bff54bf3ae1 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_resourceidentity.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_databaseupdate.go @@ -1,8 +1,8 @@ -package videoanalyzers +package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type ResourceIdentity struct { - UserAssignedIdentity string `json:"userAssignedIdentity"` +type DatabaseUpdate struct { + Properties *DatabaseUpdateProperties `json:"properties,omitempty"` } diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_databaseupdateproperties.go b/resource-manager/redisenterprise/2025-07-01/databases/model_databaseupdateproperties.go new file mode 100644 index 00000000000..b55e7c3c15a --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_databaseupdateproperties.go @@ -0,0 +1,19 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseUpdateProperties struct { + AccessKeysAuthentication *AccessKeysAuthentication `json:"accessKeysAuthentication,omitempty"` + ClientProtocol *Protocol `json:"clientProtocol,omitempty"` + ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + DeferUpgrade *DeferUpgradeSetting `json:"deferUpgrade,omitempty"` + EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` + GeoReplication *DatabaseCommonPropertiesGeoReplication `json:"geoReplication,omitempty"` + Modules *[]Module `json:"modules,omitempty"` + Persistence *Persistence `json:"persistence,omitempty"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_tokenclaim.go b/resource-manager/redisenterprise/2025-07-01/databases/model_exportclusterparameters.go similarity index 62% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/model_tokenclaim.go rename to resource-manager/redisenterprise/2025-07-01/databases/model_exportclusterparameters.go index 524dd3ca397..35c3ad5e660 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_tokenclaim.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_exportclusterparameters.go @@ -1,9 +1,8 @@ -package videos +package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type TokenClaim struct { - Name string `json:"name"` - Value string `json:"value"` +type ExportClusterParameters struct { + SasUri string `json:"sasUri"` } diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videomediainfo.go b/resource-manager/redisenterprise/2025-07-01/databases/model_flushparameters.go similarity index 61% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videomediainfo.go rename to resource-manager/redisenterprise/2025-07-01/databases/model_flushparameters.go index ea987b5de40..7ac8c6633b3 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videomediainfo.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_flushparameters.go @@ -1,8 +1,8 @@ -package videos +package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideoMediaInfo struct { - SegmentLength *string `json:"segmentLength,omitempty"` +type FlushParameters struct { + Ids *[]string `json:"ids,omitempty"` } diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_forcelinkparameters.go b/resource-manager/redisenterprise/2025-07-01/databases/model_forcelinkparameters.go new file mode 100644 index 00000000000..8d9d8518ad1 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_forcelinkparameters.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceLinkParameters struct { + GeoReplication ForceLinkParametersGeoReplication `json:"geoReplication"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_forcelinkparametersgeoreplication.go b/resource-manager/redisenterprise/2025-07-01/databases/model_forcelinkparametersgeoreplication.go new file mode 100644 index 00000000000..89772649f89 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_forcelinkparametersgeoreplication.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceLinkParametersGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videostreaming.go b/resource-manager/redisenterprise/2025-07-01/databases/model_forceunlinkparameters.go similarity index 61% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videostreaming.go rename to resource-manager/redisenterprise/2025-07-01/databases/model_forceunlinkparameters.go index 613b0994ec5..f3f97fbc4bf 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videostreaming.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_forceunlinkparameters.go @@ -1,8 +1,8 @@ -package videos +package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideoStreaming struct { - ArchiveBaseURL *string `json:"archiveBaseUrl,omitempty"` +type ForceUnlinkParameters struct { + Ids []string `json:"ids"` } diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_importclusterparameters.go b/resource-manager/redisenterprise/2025-07-01/databases/model_importclusterparameters.go new file mode 100644 index 00000000000..fa3be54a50f --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_importclusterparameters.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportClusterParameters struct { + SasUris []string `json:"sasUris"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_linkeddatabase.go b/resource-manager/redisenterprise/2025-07-01/databases/model_linkeddatabase.go new file mode 100644 index 00000000000..215442f62da --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_linkeddatabase.go @@ -0,0 +1,9 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedDatabase struct { + Id *string `json:"id,omitempty"` + State *LinkState `json:"state,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_module.go b/resource-manager/redisenterprise/2025-07-01/databases/model_module.go new file mode 100644 index 00000000000..bde6a3ad4d4 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_module.go @@ -0,0 +1,10 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Module struct { + Args *string `json:"args,omitempty"` + Name string `json:"name"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_persistence.go b/resource-manager/redisenterprise/2025-07-01/databases/model_persistence.go new file mode 100644 index 00000000000..fd1e748a3dd --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_persistence.go @@ -0,0 +1,11 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Persistence struct { + AofEnabled *bool `json:"aofEnabled,omitempty"` + AofFrequency *AofFrequency `json:"aofFrequency,omitempty"` + RdbEnabled *bool `json:"rdbEnabled,omitempty"` + RdbFrequency *RdbFrequency `json:"rdbFrequency,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/databases/model_regeneratekeyparameters.go b/resource-manager/redisenterprise/2025-07-01/databases/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..fa84cc54ad5 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package databases + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + KeyType AccessKeyType `json:"keyType"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/predicates.go b/resource-manager/redisenterprise/2025-07-01/databases/predicates.go similarity index 74% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/predicates.go rename to resource-manager/redisenterprise/2025-07-01/databases/predicates.go index a84fc28f96b..2807e5e11fc 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/predicates.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/predicates.go @@ -1,15 +1,15 @@ -package videos +package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type AccessPolicyEntityOperationPredicate struct { +type AccessPolicyAssignmentOperationPredicate struct { Id *string Name *string Type *string } -func (p AccessPolicyEntityOperationPredicate) Matches(input AccessPolicyEntity) bool { +func (p AccessPolicyAssignmentOperationPredicate) Matches(input AccessPolicyAssignment) bool { if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false @@ -26,13 +26,13 @@ func (p AccessPolicyEntityOperationPredicate) Matches(input AccessPolicyEntity) return true } -type VideoEntityOperationPredicate struct { +type DatabaseOperationPredicate struct { Id *string Name *string Type *string } -func (p VideoEntityOperationPredicate) Matches(input VideoEntity) bool { +func (p DatabaseOperationPredicate) Matches(input Database) bool { if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { return false diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/version.go b/resource-manager/redisenterprise/2025-07-01/databases/version.go similarity index 60% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/version.go rename to resource-manager/redisenterprise/2025-07-01/databases/version.go index a75ef2b2979..42d5dbacc22 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/version.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/version.go @@ -1,10 +1,10 @@ -package videos +package databases // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2021-05-01-preview" +const defaultApiVersion = "2025-07-01" func userAgent() string { - return "hashicorp/go-azure-sdk/videos/2021-05-01-preview" + return "hashicorp/go-azure-sdk/databases/2025-07-01" } diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/README.md b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/README.md new file mode 100644 index 00000000000..e56385fec01 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/README.md @@ -0,0 +1,81 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2025-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "privateEndpointConnectionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "privateEndpointConnectionName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.List` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Put` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "privateEndpointConnectionName") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.PutThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/client.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/client.go new file mode 100644 index 00000000000..50eaf09dcce --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/client.go @@ -0,0 +1,26 @@ +package privateendpointconnections + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionsClient struct { + Client *resourcemanager.Client +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "privateendpointconnections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) + } + + return &PrivateEndpointConnectionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/constants.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/constants.go new file mode 100644 index 00000000000..c5850609650 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/constants.go @@ -0,0 +1,101 @@ +package privateendpointconnections + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 00000000000..26ef2c08058 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,139 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&PrivateEndpointConnectionId{}) +} + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) + } + + return nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionName"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_privateendpointconnection_test.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_privateendpointconnection_test.go new file mode 100644 index 00000000000..6361371497e --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_privateendpointconnection_test.go @@ -0,0 +1,327 @@ +package privateendpointconnections + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +func TestNewPrivateEndpointConnectionID(t *testing.T) { + id := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "privateEndpointConnectionName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") + } + + if id.PrivateEndpointConnectionName != "privateEndpointConnectionName" { + t.Fatalf("Expected %q but got %q for Segment 'PrivateEndpointConnectionName'", id.PrivateEndpointConnectionName, "privateEndpointConnectionName") + } +} + +func TestFormatPrivateEndpointConnectionID(t *testing.T) { + actual := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "privateEndpointConnectionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/privateEndpointConnections/privateEndpointConnectionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateEndpointConnectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/privateEndpointConnections", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestParsePrivateEndpointConnectionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/privateEndpointConnections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + PrivateEndpointConnectionName: "pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestSegmentsForPrivateEndpointConnectionId(t *testing.T) { + segments := PrivateEndpointConnectionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateEndpointConnectionId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_redisenterprise.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_redisenterprise.go new file mode 100644 index 00000000000..6449511cb2f --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_redisenterprise.go @@ -0,0 +1,130 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&RedisEnterpriseId{}) +} + +var _ resourceids.ResourceId = &RedisEnterpriseId{} + +// RedisEnterpriseId is a struct representing the Resource ID for a Redis Enterprise +type RedisEnterpriseId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string +} + +// NewRedisEnterpriseID returns a new RedisEnterpriseId struct +func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string) RedisEnterpriseId { + return RedisEnterpriseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + } +} + +// ParseRedisEnterpriseID parses 'input' into a RedisEnterpriseId +func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRedisEnterpriseIDInsensitively parses 'input' case-insensitively into a RedisEnterpriseId +// note: this method should only be used for API response data and not user input +func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RedisEnterpriseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + return nil +} + +// ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID +func ValidateRedisEnterpriseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRedisEnterpriseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redis Enterprise ID +func (id RedisEnterpriseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redis Enterprise ID +func (id RedisEnterpriseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + } +} + +// String returns a human-readable description of this Redis Enterprise ID +func (id RedisEnterpriseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + } + return fmt.Sprintf("Redis Enterprise (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_redisenterprise_test.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_redisenterprise_test.go new file mode 100644 index 00000000000..d5ce5afd6e9 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/id_redisenterprise_test.go @@ -0,0 +1,282 @@ +package privateendpointconnections + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &RedisEnterpriseId{} + +func TestNewRedisEnterpriseID(t *testing.T) { + id := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") + } +} + +func TestFormatRedisEnterpriseID(t *testing.T) { + actual := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRedisEnterpriseID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RedisEnterpriseId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRedisEnterpriseID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + } +} + +func TestParseRedisEnterpriseIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RedisEnterpriseId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRedisEnterpriseIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + } +} + +func TestSegmentsForRedisEnterpriseId(t *testing.T) { + segments := RedisEnterpriseId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RedisEnterpriseId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_delete.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_delete.go new file mode 100644 index 00000000000..63c26e8f27f --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_delete.go @@ -0,0 +1,71 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersget.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_get.go similarity index 74% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersget.go rename to resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_get.go index dde47a8ddcc..351242746d4 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersget.go +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_get.go @@ -1,4 +1,4 @@ -package videoanalyzers +package privateendpointconnections import ( "context" @@ -11,14 +11,14 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideoAnalyzersGetOperationResponse struct { +type GetOperationResponse struct { HttpResponse *http.Response OData *odata.OData - Model *VideoAnalyzer + Model *PrivateEndpointConnection } -// VideoAnalyzersGet ... -func (c VideoAnalyzersClient) VideoAnalyzersGet(ctx context.Context, id VideoAnalyzerId) (result VideoAnalyzersGetOperationResponse, err error) { +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ @@ -43,7 +43,7 @@ func (c VideoAnalyzersClient) VideoAnalyzersGet(ctx context.Context, id VideoAna return } - var model VideoAnalyzer + var model PrivateEndpointConnection result.Model = &model if err = resp.Unmarshal(result.Model); err != nil { return diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_list.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_list.go new file mode 100644 index 00000000000..fbc4f5b3c1c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_list.go @@ -0,0 +1,54 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnectionListResult +} + +// List ... +func (c PrivateEndpointConnectionsClient) List(ctx context.Context, id RedisEnterpriseId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateEndpointConnections", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model PrivateEndpointConnectionListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_put.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_put.go new file mode 100644 index 00000000000..8f6e3022d15 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/method_put.go @@ -0,0 +1,74 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PutOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// Put ... +func (c PrivateEndpointConnectionsClient) Put(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (result PutOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// PutThenPoll performs Put then polls until it's completed +func (c PrivateEndpointConnectionsClient) PutThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) error { + result, err := c.Put(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Put: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Put: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpoint.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpoint.go new file mode 100644 index 00000000000..1bc8cf2a97c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpoint.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnection.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 00000000000..fde7f4db0fc --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnectionlistresult.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnectionlistresult.go new file mode 100644 index 00000000000..92a9ecb105a --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnectionlistresult.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionListResult struct { + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnectionproperties.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..549d255f069 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..ec3f7a9f24c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/version.go b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/version.go new file mode 100644 index 00000000000..34114d7d09d --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/version.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-07-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/privateendpointconnections/2025-07-01" +} diff --git a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/README.md b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/README.md new file mode 100644 index 00000000000..93cd1b471dc --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/privatelinkresources` Documentation + +The `privatelinkresources` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2025-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/privatelinkresources" +``` + + +### Client Initialization + +```go +client := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateLinkResourcesClient.ListByCluster` + +```go +ctx := context.TODO() +id := privatelinkresources.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +read, err := client.ListByCluster(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/client.go similarity index 50% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go rename to resource-manager/redisenterprise/2025-07-01/privatelinkresources/client.go index db53492c2b7..28c00b21f03 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/client.go +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/client.go @@ -1,4 +1,4 @@ -package edgemodules +package privatelinkresources import ( "fmt" @@ -10,17 +10,17 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type EdgeModulesClient struct { +type PrivateLinkResourcesClient struct { Client *resourcemanager.Client } -func NewEdgeModulesClientWithBaseURI(sdkApi sdkEnv.Api) (*EdgeModulesClient, error) { - client, err := resourcemanager.NewClient(sdkApi, "edgemodules", defaultApiVersion) +func NewPrivateLinkResourcesClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateLinkResourcesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "privatelinkresources", defaultApiVersion) if err != nil { - return nil, fmt.Errorf("instantiating EdgeModulesClient: %+v", err) + return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) } - return &EdgeModulesClient{ + return &PrivateLinkResourcesClient{ Client: client, }, nil } diff --git a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/id_redisenterprise.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/id_redisenterprise.go new file mode 100644 index 00000000000..b57b6c2bd42 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/id_redisenterprise.go @@ -0,0 +1,130 @@ +package privatelinkresources + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&RedisEnterpriseId{}) +} + +var _ resourceids.ResourceId = &RedisEnterpriseId{} + +// RedisEnterpriseId is a struct representing the Resource ID for a Redis Enterprise +type RedisEnterpriseId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string +} + +// NewRedisEnterpriseID returns a new RedisEnterpriseId struct +func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string) RedisEnterpriseId { + return RedisEnterpriseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + } +} + +// ParseRedisEnterpriseID parses 'input' into a RedisEnterpriseId +func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRedisEnterpriseIDInsensitively parses 'input' case-insensitively into a RedisEnterpriseId +// note: this method should only be used for API response data and not user input +func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RedisEnterpriseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + return nil +} + +// ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID +func ValidateRedisEnterpriseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRedisEnterpriseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redis Enterprise ID +func (id RedisEnterpriseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redis Enterprise ID +func (id RedisEnterpriseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + } +} + +// String returns a human-readable description of this Redis Enterprise ID +func (id RedisEnterpriseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + } + return fmt.Sprintf("Redis Enterprise (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer_test.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/id_redisenterprise_test.go similarity index 66% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer_test.go rename to resource-manager/redisenterprise/2025-07-01/privatelinkresources/id_redisenterprise_test.go index b29d9052f48..c43caa9e0f6 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer_test.go +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/id_redisenterprise_test.go @@ -1,4 +1,4 @@ -package videoanalyzers +package privatelinkresources import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VideoAnalyzerId{} +var _ resourceids.ResourceId = &RedisEnterpriseId{} -func TestNewVideoAnalyzerID(t *testing.T) { - id := NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") +func TestNewRedisEnterpriseID(t *testing.T) { + id := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,24 +22,24 @@ func TestNewVideoAnalyzerID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VideoAnalyzerName != "videoAnalyzerName" { - t.Fatalf("Expected %q but got %q for Segment 'VideoAnalyzerName'", id.VideoAnalyzerName, "videoAnalyzerName") + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") } } -func TestFormatVideoAnalyzerID(t *testing.T) { - actual := NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName" +func TestFormatRedisEnterpriseID(t *testing.T) { + actual := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVideoAnalyzerID(t *testing.T) { +func TestParseRedisEnterpriseID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoAnalyzerId + Expected *RedisEnterpriseId }{ { // Incomplete URI @@ -73,33 +73,33 @@ func TestParseVideoAnalyzerID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoAnalyzerID(v.Input) + actual, err := ParseRedisEnterpriseID(v.Input) if err != nil { if v.Error { continue @@ -119,18 +119,18 @@ func TestParseVideoAnalyzerID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } } } -func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { +func TestParseRedisEnterpriseIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoAnalyzerId + Expected *RedisEnterpriseId }{ { // Incomplete URI @@ -189,57 +189,57 @@ func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VideoAnalyzerName: "vIdEoAnAlYzErNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoAnalyzerIDInsensitively(v.Input) + actual, err := ParseRedisEnterpriseIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -259,17 +259,17 @@ func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } } } -func TestSegmentsForVideoAnalyzerId(t *testing.T) { - segments := VideoAnalyzerId{}.Segments() +func TestSegmentsForRedisEnterpriseId(t *testing.T) { + segments := RedisEnterpriseId{}.Segments() if len(segments) == 0 { - t.Fatalf("VideoAnalyzerId has no segments") + t.Fatalf("RedisEnterpriseId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/method_listbycluster.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/method_listbycluster.go new file mode 100644 index 00000000000..ab94a7b4ec4 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/method_listbycluster.go @@ -0,0 +1,54 @@ +package privatelinkresources + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResourceListResult +} + +// ListByCluster ... +func (c PrivateLinkResourcesClient) ListByCluster(ctx context.Context, id RedisEnterpriseId) (result ListByClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/privateLinkResources", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model PrivateLinkResourceListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresource.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresource.go new file mode 100644 index 00000000000..69e8ae0e57a --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresource.go @@ -0,0 +1,11 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresourcelistresult.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresourcelistresult.go new file mode 100644 index 00000000000..fa950217c47 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresourcelistresult.go @@ -0,0 +1,8 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourceListResult struct { + Value *[]PrivateLinkResource `json:"value,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresourceproperties.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresourceproperties.go new file mode 100644 index 00000000000..3c98012cdd1 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresourceproperties.go @@ -0,0 +1,10 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourceProperties struct { + GroupId *string `json:"groupId,omitempty"` + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/version.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/version.go similarity index 57% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/version.go rename to resource-manager/redisenterprise/2025-07-01/privatelinkresources/version.go index edadb975892..f496ac19324 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/version.go +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/version.go @@ -1,10 +1,10 @@ -package videoanalyzers +package privatelinkresources // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2021-05-01-preview" +const defaultApiVersion = "2025-07-01" func userAgent() string { - return "hashicorp/go-azure-sdk/videoanalyzers/2021-05-01-preview" + return "hashicorp/go-azure-sdk/privatelinkresources/2025-07-01" } diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/README.md b/resource-manager/redisenterprise/2025-07-01/redisenterprise/README.md new file mode 100644 index 00000000000..9fa65f7d4e3 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/README.md @@ -0,0 +1,404 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/redisenterprise` Documentation + +The `redisenterprise` SDK allows for interaction with Azure Resource Manager `redisenterprise` (API Version `2025-07-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/redisenterprise/2025-07-01/redisenterprise" +``` + + +### Client Initialization + +```go +client := redisenterprise.NewRedisEnterpriseClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RedisEnterpriseClient.AccessPolicyAssignmentCreateUpdate` + +```go +ctx := context.TODO() +id := redisenterprise.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +payload := redisenterprise.AccessPolicyAssignment{ + // ... +} + + +if err := client.AccessPolicyAssignmentCreateUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.AccessPolicyAssignmentDelete` + +```go +ctx := context.TODO() +id := redisenterprise.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +if err := client.AccessPolicyAssignmentDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.AccessPolicyAssignmentGet` + +```go +ctx := context.TODO() +id := redisenterprise.NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + +read, err := client.AccessPolicyAssignmentGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.AccessPolicyAssignmentList` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +// alternatively `client.AccessPolicyAssignmentList(ctx, id)` can be used to do batched pagination +items, err := client.AccessPolicyAssignmentListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisEnterpriseClient.Create` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +payload := redisenterprise.Cluster{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesCreate` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.Database{ + // ... +} + + +if err := client.DatabasesCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesDelete` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +if err := client.DatabasesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesExport` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.ExportClusterParameters{ + // ... +} + + +if err := client.DatabasesExportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesFlush` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.FlushParameters{ + // ... +} + + +if err := client.DatabasesFlushThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesForceLinkToReplicationGroup` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.ForceLinkParameters{ + // ... +} + + +if err := client.DatabasesForceLinkToReplicationGroupThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesForceUnlink` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.ForceUnlinkParameters{ + // ... +} + + +if err := client.DatabasesForceUnlinkThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesGet` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +read, err := client.DatabasesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesImport` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.ImportClusterParameters{ + // ... +} + + +if err := client.DatabasesImportThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesListByCluster` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +// alternatively `client.DatabasesListByCluster(ctx, id)` can be used to do batched pagination +items, err := client.DatabasesListByClusterComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesListKeys` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +read, err := client.DatabasesListKeys(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesRegenerateKey` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.RegenerateKeyParameters{ + // ... +} + + +if err := client.DatabasesRegenerateKeyThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesUpdate` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +payload := redisenterprise.DatabaseUpdate{ + // ... +} + + +if err := client.DatabasesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.DatabasesUpgradeDBRedisVersion` + +```go +ctx := context.TODO() +id := redisenterprise.NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") + +if err := client.DatabasesUpgradeDBRedisVersionThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.Delete` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RedisEnterpriseClient.Get` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.List` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisEnterpriseClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RedisEnterpriseClient.ListSkusForScaling` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +read, err := client.ListSkusForScaling(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RedisEnterpriseClient.Update` + +```go +ctx := context.TODO() +id := redisenterprise.NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") + +payload := redisenterprise.ClusterUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/client.go similarity index 52% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/client.go index e00009f4944..08640dfb307 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/client.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/client.go @@ -1,4 +1,4 @@ -package videoanalyzers +package redisenterprise import ( "fmt" @@ -10,17 +10,17 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideoAnalyzersClient struct { +type RedisEnterpriseClient struct { Client *resourcemanager.Client } -func NewVideoAnalyzersClientWithBaseURI(sdkApi sdkEnv.Api) (*VideoAnalyzersClient, error) { - client, err := resourcemanager.NewClient(sdkApi, "videoanalyzers", defaultApiVersion) +func NewRedisEnterpriseClientWithBaseURI(sdkApi sdkEnv.Api) (*RedisEnterpriseClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "redisenterprise", defaultApiVersion) if err != nil { - return nil, fmt.Errorf("instantiating VideoAnalyzersClient: %+v", err) + return nil, fmt.Errorf("instantiating RedisEnterpriseClient: %+v", err) } - return &VideoAnalyzersClient{ + return &RedisEnterpriseClient{ Client: client, }, nil } diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/constants.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/constants.go new file mode 100644 index 00000000000..9755c451162 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/constants.go @@ -0,0 +1,1088 @@ +package redisenterprise + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeyType string + +const ( + AccessKeyTypePrimary AccessKeyType = "Primary" + AccessKeyTypeSecondary AccessKeyType = "Secondary" +) + +func PossibleValuesForAccessKeyType() []string { + return []string{ + string(AccessKeyTypePrimary), + string(AccessKeyTypeSecondary), + } +} + +func (s *AccessKeyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessKeyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAccessKeyType(input string) (*AccessKeyType, error) { + vals := map[string]AccessKeyType{ + "primary": AccessKeyTypePrimary, + "secondary": AccessKeyTypeSecondary, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessKeyType(input) + return &out, nil +} + +type AccessKeysAuthentication string + +const ( + AccessKeysAuthenticationDisabled AccessKeysAuthentication = "Disabled" + AccessKeysAuthenticationEnabled AccessKeysAuthentication = "Enabled" +) + +func PossibleValuesForAccessKeysAuthentication() []string { + return []string{ + string(AccessKeysAuthenticationDisabled), + string(AccessKeysAuthenticationEnabled), + } +} + +func (s *AccessKeysAuthentication) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAccessKeysAuthentication(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAccessKeysAuthentication(input string) (*AccessKeysAuthentication, error) { + vals := map[string]AccessKeysAuthentication{ + "disabled": AccessKeysAuthenticationDisabled, + "enabled": AccessKeysAuthenticationEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AccessKeysAuthentication(input) + return &out, nil +} + +type AofFrequency string + +const ( + AofFrequencyAlways AofFrequency = "always" + AofFrequencyOnes AofFrequency = "1s" +) + +func PossibleValuesForAofFrequency() []string { + return []string{ + string(AofFrequencyAlways), + string(AofFrequencyOnes), + } +} + +func (s *AofFrequency) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAofFrequency(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAofFrequency(input string) (*AofFrequency, error) { + vals := map[string]AofFrequency{ + "always": AofFrequencyAlways, + "1s": AofFrequencyOnes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AofFrequency(input) + return &out, nil +} + +type ClusteringPolicy string + +const ( + ClusteringPolicyEnterpriseCluster ClusteringPolicy = "EnterpriseCluster" + ClusteringPolicyNoCluster ClusteringPolicy = "NoCluster" + ClusteringPolicyOSSCluster ClusteringPolicy = "OSSCluster" +) + +func PossibleValuesForClusteringPolicy() []string { + return []string{ + string(ClusteringPolicyEnterpriseCluster), + string(ClusteringPolicyNoCluster), + string(ClusteringPolicyOSSCluster), + } +} + +func (s *ClusteringPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseClusteringPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseClusteringPolicy(input string) (*ClusteringPolicy, error) { + vals := map[string]ClusteringPolicy{ + "enterprisecluster": ClusteringPolicyEnterpriseCluster, + "nocluster": ClusteringPolicyNoCluster, + "osscluster": ClusteringPolicyOSSCluster, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClusteringPolicy(input) + return &out, nil +} + +type CmkIdentityType string + +const ( + CmkIdentityTypeSystemAssignedIdentity CmkIdentityType = "systemAssignedIdentity" + CmkIdentityTypeUserAssignedIdentity CmkIdentityType = "userAssignedIdentity" +) + +func PossibleValuesForCmkIdentityType() []string { + return []string{ + string(CmkIdentityTypeSystemAssignedIdentity), + string(CmkIdentityTypeUserAssignedIdentity), + } +} + +func (s *CmkIdentityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCmkIdentityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCmkIdentityType(input string) (*CmkIdentityType, error) { + vals := map[string]CmkIdentityType{ + "systemassignedidentity": CmkIdentityTypeSystemAssignedIdentity, + "userassignedidentity": CmkIdentityTypeUserAssignedIdentity, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CmkIdentityType(input) + return &out, nil +} + +type DeferUpgradeSetting string + +const ( + DeferUpgradeSettingDeferred DeferUpgradeSetting = "Deferred" + DeferUpgradeSettingNotDeferred DeferUpgradeSetting = "NotDeferred" +) + +func PossibleValuesForDeferUpgradeSetting() []string { + return []string{ + string(DeferUpgradeSettingDeferred), + string(DeferUpgradeSettingNotDeferred), + } +} + +func (s *DeferUpgradeSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeferUpgradeSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeferUpgradeSetting(input string) (*DeferUpgradeSetting, error) { + vals := map[string]DeferUpgradeSetting{ + "deferred": DeferUpgradeSettingDeferred, + "notdeferred": DeferUpgradeSettingNotDeferred, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeferUpgradeSetting(input) + return &out, nil +} + +type EvictionPolicy string + +const ( + EvictionPolicyAllKeysLFU EvictionPolicy = "AllKeysLFU" + EvictionPolicyAllKeysLRU EvictionPolicy = "AllKeysLRU" + EvictionPolicyAllKeysRandom EvictionPolicy = "AllKeysRandom" + EvictionPolicyNoEviction EvictionPolicy = "NoEviction" + EvictionPolicyVolatileLFU EvictionPolicy = "VolatileLFU" + EvictionPolicyVolatileLRU EvictionPolicy = "VolatileLRU" + EvictionPolicyVolatileRandom EvictionPolicy = "VolatileRandom" + EvictionPolicyVolatileTTL EvictionPolicy = "VolatileTTL" +) + +func PossibleValuesForEvictionPolicy() []string { + return []string{ + string(EvictionPolicyAllKeysLFU), + string(EvictionPolicyAllKeysLRU), + string(EvictionPolicyAllKeysRandom), + string(EvictionPolicyNoEviction), + string(EvictionPolicyVolatileLFU), + string(EvictionPolicyVolatileLRU), + string(EvictionPolicyVolatileRandom), + string(EvictionPolicyVolatileTTL), + } +} + +func (s *EvictionPolicy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEvictionPolicy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEvictionPolicy(input string) (*EvictionPolicy, error) { + vals := map[string]EvictionPolicy{ + "allkeyslfu": EvictionPolicyAllKeysLFU, + "allkeyslru": EvictionPolicyAllKeysLRU, + "allkeysrandom": EvictionPolicyAllKeysRandom, + "noeviction": EvictionPolicyNoEviction, + "volatilelfu": EvictionPolicyVolatileLFU, + "volatilelru": EvictionPolicyVolatileLRU, + "volatilerandom": EvictionPolicyVolatileRandom, + "volatilettl": EvictionPolicyVolatileTTL, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EvictionPolicy(input) + return &out, nil +} + +type HighAvailability string + +const ( + HighAvailabilityDisabled HighAvailability = "Disabled" + HighAvailabilityEnabled HighAvailability = "Enabled" +) + +func PossibleValuesForHighAvailability() []string { + return []string{ + string(HighAvailabilityDisabled), + string(HighAvailabilityEnabled), + } +} + +func (s *HighAvailability) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHighAvailability(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHighAvailability(input string) (*HighAvailability, error) { + vals := map[string]HighAvailability{ + "disabled": HighAvailabilityDisabled, + "enabled": HighAvailabilityEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HighAvailability(input) + return &out, nil +} + +type Kind string + +const ( + KindVOne Kind = "v1" + KindVTwo Kind = "v2" +) + +func PossibleValuesForKind() []string { + return []string{ + string(KindVOne), + string(KindVTwo), + } +} + +func (s *Kind) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKind(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseKind(input string) (*Kind, error) { + vals := map[string]Kind{ + "v1": KindVOne, + "v2": KindVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Kind(input) + return &out, nil +} + +type LinkState string + +const ( + LinkStateLinkFailed LinkState = "LinkFailed" + LinkStateLinked LinkState = "Linked" + LinkStateLinking LinkState = "Linking" + LinkStateUnlinkFailed LinkState = "UnlinkFailed" + LinkStateUnlinking LinkState = "Unlinking" +) + +func PossibleValuesForLinkState() []string { + return []string{ + string(LinkStateLinkFailed), + string(LinkStateLinked), + string(LinkStateLinking), + string(LinkStateUnlinkFailed), + string(LinkStateUnlinking), + } +} + +func (s *LinkState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinkState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinkState(input string) (*LinkState, error) { + vals := map[string]LinkState{ + "linkfailed": LinkStateLinkFailed, + "linked": LinkStateLinked, + "linking": LinkStateLinking, + "unlinkfailed": LinkStateUnlinkFailed, + "unlinking": LinkStateUnlinking, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinkState(input) + return &out, nil +} + +type PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} + +type Protocol string + +const ( + ProtocolEncrypted Protocol = "Encrypted" + ProtocolPlaintext Protocol = "Plaintext" +) + +func PossibleValuesForProtocol() []string { + return []string{ + string(ProtocolEncrypted), + string(ProtocolPlaintext), + } +} + +func (s *Protocol) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocol(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocol(input string) (*Protocol, error) { + vals := map[string]Protocol{ + "encrypted": ProtocolEncrypted, + "plaintext": ProtocolPlaintext, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Protocol(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreating), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "creating": ProvisioningStateCreating, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} + +type RdbFrequency string + +const ( + RdbFrequencyOneTwoh RdbFrequency = "12h" + RdbFrequencyOneh RdbFrequency = "1h" + RdbFrequencySixh RdbFrequency = "6h" +) + +func PossibleValuesForRdbFrequency() []string { + return []string{ + string(RdbFrequencyOneTwoh), + string(RdbFrequencyOneh), + string(RdbFrequencySixh), + } +} + +func (s *RdbFrequency) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRdbFrequency(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRdbFrequency(input string) (*RdbFrequency, error) { + vals := map[string]RdbFrequency{ + "12h": RdbFrequencyOneTwoh, + "1h": RdbFrequencyOneh, + "6h": RdbFrequencySixh, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RdbFrequency(input) + return &out, nil +} + +type RedundancyMode string + +const ( + RedundancyModeLR RedundancyMode = "LR" + RedundancyModeNone RedundancyMode = "None" + RedundancyModeZR RedundancyMode = "ZR" +) + +func PossibleValuesForRedundancyMode() []string { + return []string{ + string(RedundancyModeLR), + string(RedundancyModeNone), + string(RedundancyModeZR), + } +} + +func (s *RedundancyMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRedundancyMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRedundancyMode(input string) (*RedundancyMode, error) { + vals := map[string]RedundancyMode{ + "lr": RedundancyModeLR, + "none": RedundancyModeNone, + "zr": RedundancyModeZR, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RedundancyMode(input) + return &out, nil +} + +type ResourceState string + +const ( + ResourceStateCreateFailed ResourceState = "CreateFailed" + ResourceStateCreating ResourceState = "Creating" + ResourceStateDeleteFailed ResourceState = "DeleteFailed" + ResourceStateDeleting ResourceState = "Deleting" + ResourceStateDisableFailed ResourceState = "DisableFailed" + ResourceStateDisabled ResourceState = "Disabled" + ResourceStateDisabling ResourceState = "Disabling" + ResourceStateEnableFailed ResourceState = "EnableFailed" + ResourceStateEnabling ResourceState = "Enabling" + ResourceStateMoving ResourceState = "Moving" + ResourceStateRunning ResourceState = "Running" + ResourceStateScaling ResourceState = "Scaling" + ResourceStateScalingFailed ResourceState = "ScalingFailed" + ResourceStateUpdateFailed ResourceState = "UpdateFailed" + ResourceStateUpdating ResourceState = "Updating" +) + +func PossibleValuesForResourceState() []string { + return []string{ + string(ResourceStateCreateFailed), + string(ResourceStateCreating), + string(ResourceStateDeleteFailed), + string(ResourceStateDeleting), + string(ResourceStateDisableFailed), + string(ResourceStateDisabled), + string(ResourceStateDisabling), + string(ResourceStateEnableFailed), + string(ResourceStateEnabling), + string(ResourceStateMoving), + string(ResourceStateRunning), + string(ResourceStateScaling), + string(ResourceStateScalingFailed), + string(ResourceStateUpdateFailed), + string(ResourceStateUpdating), + } +} + +func (s *ResourceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceState(input string) (*ResourceState, error) { + vals := map[string]ResourceState{ + "createfailed": ResourceStateCreateFailed, + "creating": ResourceStateCreating, + "deletefailed": ResourceStateDeleteFailed, + "deleting": ResourceStateDeleting, + "disablefailed": ResourceStateDisableFailed, + "disabled": ResourceStateDisabled, + "disabling": ResourceStateDisabling, + "enablefailed": ResourceStateEnableFailed, + "enabling": ResourceStateEnabling, + "moving": ResourceStateMoving, + "running": ResourceStateRunning, + "scaling": ResourceStateScaling, + "scalingfailed": ResourceStateScalingFailed, + "updatefailed": ResourceStateUpdateFailed, + "updating": ResourceStateUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceState(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameBalancedBFive SkuName = "Balanced_B5" + SkuNameBalancedBFiveHundred SkuName = "Balanced_B500" + SkuNameBalancedBFiveZero SkuName = "Balanced_B50" + SkuNameBalancedBOne SkuName = "Balanced_B1" + SkuNameBalancedBOneFiveZero SkuName = "Balanced_B150" + SkuNameBalancedBOneHundred SkuName = "Balanced_B100" + SkuNameBalancedBOneThousand SkuName = "Balanced_B1000" + SkuNameBalancedBOneZero SkuName = "Balanced_B10" + SkuNameBalancedBSevenHundred SkuName = "Balanced_B700" + SkuNameBalancedBThree SkuName = "Balanced_B3" + SkuNameBalancedBThreeFiveZero SkuName = "Balanced_B350" + SkuNameBalancedBTwoFiveZero SkuName = "Balanced_B250" + SkuNameBalancedBTwoZero SkuName = "Balanced_B20" + SkuNameBalancedBZero SkuName = "Balanced_B0" + SkuNameComputeOptimizedXFive SkuName = "ComputeOptimized_X5" + SkuNameComputeOptimizedXFiveHundred SkuName = "ComputeOptimized_X500" + SkuNameComputeOptimizedXFiveZero SkuName = "ComputeOptimized_X50" + SkuNameComputeOptimizedXOneFiveZero SkuName = "ComputeOptimized_X150" + SkuNameComputeOptimizedXOneHundred SkuName = "ComputeOptimized_X100" + SkuNameComputeOptimizedXOneZero SkuName = "ComputeOptimized_X10" + SkuNameComputeOptimizedXSevenHundred SkuName = "ComputeOptimized_X700" + SkuNameComputeOptimizedXThree SkuName = "ComputeOptimized_X3" + SkuNameComputeOptimizedXThreeFiveZero SkuName = "ComputeOptimized_X350" + SkuNameComputeOptimizedXTwoFiveZero SkuName = "ComputeOptimized_X250" + SkuNameComputeOptimizedXTwoZero SkuName = "ComputeOptimized_X20" + SkuNameEnterpriseEFive SkuName = "Enterprise_E5" + SkuNameEnterpriseEFiveZero SkuName = "Enterprise_E50" + SkuNameEnterpriseEFourHundred SkuName = "Enterprise_E400" + SkuNameEnterpriseEOne SkuName = "Enterprise_E1" + SkuNameEnterpriseEOneHundred SkuName = "Enterprise_E100" + SkuNameEnterpriseEOneZero SkuName = "Enterprise_E10" + SkuNameEnterpriseETwoHundred SkuName = "Enterprise_E200" + SkuNameEnterpriseETwoZero SkuName = "Enterprise_E20" + SkuNameEnterpriseFlashFOneFiveHundred SkuName = "EnterpriseFlash_F1500" + SkuNameEnterpriseFlashFSevenHundred SkuName = "EnterpriseFlash_F700" + SkuNameEnterpriseFlashFThreeHundred SkuName = "EnterpriseFlash_F300" + SkuNameFlashOptimizedAFiveHundred SkuName = "FlashOptimized_A500" + SkuNameFlashOptimizedAFourFiveHundred SkuName = "FlashOptimized_A4500" + SkuNameFlashOptimizedAOneFiveHundred SkuName = "FlashOptimized_A1500" + SkuNameFlashOptimizedAOneThousand SkuName = "FlashOptimized_A1000" + SkuNameFlashOptimizedASevenHundred SkuName = "FlashOptimized_A700" + SkuNameFlashOptimizedATwoFiveZero SkuName = "FlashOptimized_A250" + SkuNameFlashOptimizedATwoThousand SkuName = "FlashOptimized_A2000" + SkuNameMemoryOptimizedMFiveHundred SkuName = "MemoryOptimized_M500" + SkuNameMemoryOptimizedMFiveZero SkuName = "MemoryOptimized_M50" + SkuNameMemoryOptimizedMOneFiveHundred SkuName = "MemoryOptimized_M1500" + SkuNameMemoryOptimizedMOneFiveZero SkuName = "MemoryOptimized_M150" + SkuNameMemoryOptimizedMOneHundred SkuName = "MemoryOptimized_M100" + SkuNameMemoryOptimizedMOneThousand SkuName = "MemoryOptimized_M1000" + SkuNameMemoryOptimizedMOneZero SkuName = "MemoryOptimized_M10" + SkuNameMemoryOptimizedMSevenHundred SkuName = "MemoryOptimized_M700" + SkuNameMemoryOptimizedMThreeFiveZero SkuName = "MemoryOptimized_M350" + SkuNameMemoryOptimizedMTwoFiveZero SkuName = "MemoryOptimized_M250" + SkuNameMemoryOptimizedMTwoThousand SkuName = "MemoryOptimized_M2000" + SkuNameMemoryOptimizedMTwoZero SkuName = "MemoryOptimized_M20" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameBalancedBFive), + string(SkuNameBalancedBFiveHundred), + string(SkuNameBalancedBFiveZero), + string(SkuNameBalancedBOne), + string(SkuNameBalancedBOneFiveZero), + string(SkuNameBalancedBOneHundred), + string(SkuNameBalancedBOneThousand), + string(SkuNameBalancedBOneZero), + string(SkuNameBalancedBSevenHundred), + string(SkuNameBalancedBThree), + string(SkuNameBalancedBThreeFiveZero), + string(SkuNameBalancedBTwoFiveZero), + string(SkuNameBalancedBTwoZero), + string(SkuNameBalancedBZero), + string(SkuNameComputeOptimizedXFive), + string(SkuNameComputeOptimizedXFiveHundred), + string(SkuNameComputeOptimizedXFiveZero), + string(SkuNameComputeOptimizedXOneFiveZero), + string(SkuNameComputeOptimizedXOneHundred), + string(SkuNameComputeOptimizedXOneZero), + string(SkuNameComputeOptimizedXSevenHundred), + string(SkuNameComputeOptimizedXThree), + string(SkuNameComputeOptimizedXThreeFiveZero), + string(SkuNameComputeOptimizedXTwoFiveZero), + string(SkuNameComputeOptimizedXTwoZero), + string(SkuNameEnterpriseEFive), + string(SkuNameEnterpriseEFiveZero), + string(SkuNameEnterpriseEFourHundred), + string(SkuNameEnterpriseEOne), + string(SkuNameEnterpriseEOneHundred), + string(SkuNameEnterpriseEOneZero), + string(SkuNameEnterpriseETwoHundred), + string(SkuNameEnterpriseETwoZero), + string(SkuNameEnterpriseFlashFOneFiveHundred), + string(SkuNameEnterpriseFlashFSevenHundred), + string(SkuNameEnterpriseFlashFThreeHundred), + string(SkuNameFlashOptimizedAFiveHundred), + string(SkuNameFlashOptimizedAFourFiveHundred), + string(SkuNameFlashOptimizedAOneFiveHundred), + string(SkuNameFlashOptimizedAOneThousand), + string(SkuNameFlashOptimizedASevenHundred), + string(SkuNameFlashOptimizedATwoFiveZero), + string(SkuNameFlashOptimizedATwoThousand), + string(SkuNameMemoryOptimizedMFiveHundred), + string(SkuNameMemoryOptimizedMFiveZero), + string(SkuNameMemoryOptimizedMOneFiveHundred), + string(SkuNameMemoryOptimizedMOneFiveZero), + string(SkuNameMemoryOptimizedMOneHundred), + string(SkuNameMemoryOptimizedMOneThousand), + string(SkuNameMemoryOptimizedMOneZero), + string(SkuNameMemoryOptimizedMSevenHundred), + string(SkuNameMemoryOptimizedMThreeFiveZero), + string(SkuNameMemoryOptimizedMTwoFiveZero), + string(SkuNameMemoryOptimizedMTwoThousand), + string(SkuNameMemoryOptimizedMTwoZero), + } +} + +func (s *SkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkuName(input string) (*SkuName, error) { + vals := map[string]SkuName{ + "balanced_b5": SkuNameBalancedBFive, + "balanced_b500": SkuNameBalancedBFiveHundred, + "balanced_b50": SkuNameBalancedBFiveZero, + "balanced_b1": SkuNameBalancedBOne, + "balanced_b150": SkuNameBalancedBOneFiveZero, + "balanced_b100": SkuNameBalancedBOneHundred, + "balanced_b1000": SkuNameBalancedBOneThousand, + "balanced_b10": SkuNameBalancedBOneZero, + "balanced_b700": SkuNameBalancedBSevenHundred, + "balanced_b3": SkuNameBalancedBThree, + "balanced_b350": SkuNameBalancedBThreeFiveZero, + "balanced_b250": SkuNameBalancedBTwoFiveZero, + "balanced_b20": SkuNameBalancedBTwoZero, + "balanced_b0": SkuNameBalancedBZero, + "computeoptimized_x5": SkuNameComputeOptimizedXFive, + "computeoptimized_x500": SkuNameComputeOptimizedXFiveHundred, + "computeoptimized_x50": SkuNameComputeOptimizedXFiveZero, + "computeoptimized_x150": SkuNameComputeOptimizedXOneFiveZero, + "computeoptimized_x100": SkuNameComputeOptimizedXOneHundred, + "computeoptimized_x10": SkuNameComputeOptimizedXOneZero, + "computeoptimized_x700": SkuNameComputeOptimizedXSevenHundred, + "computeoptimized_x3": SkuNameComputeOptimizedXThree, + "computeoptimized_x350": SkuNameComputeOptimizedXThreeFiveZero, + "computeoptimized_x250": SkuNameComputeOptimizedXTwoFiveZero, + "computeoptimized_x20": SkuNameComputeOptimizedXTwoZero, + "enterprise_e5": SkuNameEnterpriseEFive, + "enterprise_e50": SkuNameEnterpriseEFiveZero, + "enterprise_e400": SkuNameEnterpriseEFourHundred, + "enterprise_e1": SkuNameEnterpriseEOne, + "enterprise_e100": SkuNameEnterpriseEOneHundred, + "enterprise_e10": SkuNameEnterpriseEOneZero, + "enterprise_e200": SkuNameEnterpriseETwoHundred, + "enterprise_e20": SkuNameEnterpriseETwoZero, + "enterpriseflash_f1500": SkuNameEnterpriseFlashFOneFiveHundred, + "enterpriseflash_f700": SkuNameEnterpriseFlashFSevenHundred, + "enterpriseflash_f300": SkuNameEnterpriseFlashFThreeHundred, + "flashoptimized_a500": SkuNameFlashOptimizedAFiveHundred, + "flashoptimized_a4500": SkuNameFlashOptimizedAFourFiveHundred, + "flashoptimized_a1500": SkuNameFlashOptimizedAOneFiveHundred, + "flashoptimized_a1000": SkuNameFlashOptimizedAOneThousand, + "flashoptimized_a700": SkuNameFlashOptimizedASevenHundred, + "flashoptimized_a250": SkuNameFlashOptimizedATwoFiveZero, + "flashoptimized_a2000": SkuNameFlashOptimizedATwoThousand, + "memoryoptimized_m500": SkuNameMemoryOptimizedMFiveHundred, + "memoryoptimized_m50": SkuNameMemoryOptimizedMFiveZero, + "memoryoptimized_m1500": SkuNameMemoryOptimizedMOneFiveHundred, + "memoryoptimized_m150": SkuNameMemoryOptimizedMOneFiveZero, + "memoryoptimized_m100": SkuNameMemoryOptimizedMOneHundred, + "memoryoptimized_m1000": SkuNameMemoryOptimizedMOneThousand, + "memoryoptimized_m10": SkuNameMemoryOptimizedMOneZero, + "memoryoptimized_m700": SkuNameMemoryOptimizedMSevenHundred, + "memoryoptimized_m350": SkuNameMemoryOptimizedMThreeFiveZero, + "memoryoptimized_m250": SkuNameMemoryOptimizedMTwoFiveZero, + "memoryoptimized_m2000": SkuNameMemoryOptimizedMTwoThousand, + "memoryoptimized_m20": SkuNameMemoryOptimizedMTwoZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkuName(input) + return &out, nil +} + +type TlsVersion string + +const ( + TlsVersionOnePointOne TlsVersion = "1.1" + TlsVersionOnePointTwo TlsVersion = "1.2" + TlsVersionOnePointZero TlsVersion = "1.0" +) + +func PossibleValuesForTlsVersion() []string { + return []string{ + string(TlsVersionOnePointOne), + string(TlsVersionOnePointTwo), + string(TlsVersionOnePointZero), + } +} + +func (s *TlsVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTlsVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTlsVersion(input string) (*TlsVersion, error) { + vals := map[string]TlsVersion{ + "1.1": TlsVersionOnePointOne, + "1.2": TlsVersionOnePointTwo, + "1.0": TlsVersionOnePointZero, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TlsVersion(input) + return &out, nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_accesspolicyassignment.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_accesspolicyassignment.go new file mode 100644 index 00000000000..5e8e6bb4f4c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_accesspolicyassignment.go @@ -0,0 +1,148 @@ +package redisenterprise + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccessPolicyAssignmentId{}) +} + +var _ resourceids.ResourceId = &AccessPolicyAssignmentId{} + +// AccessPolicyAssignmentId is a struct representing the Resource ID for a Access Policy Assignment +type AccessPolicyAssignmentId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string + AccessPolicyAssignmentName string +} + +// NewAccessPolicyAssignmentID returns a new AccessPolicyAssignmentId struct +func NewAccessPolicyAssignmentID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string, accessPolicyAssignmentName string) AccessPolicyAssignmentId { + return AccessPolicyAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, + AccessPolicyAssignmentName: accessPolicyAssignmentName, + } +} + +// ParseAccessPolicyAssignmentID parses 'input' into a AccessPolicyAssignmentId +func ParseAccessPolicyAssignmentID(input string) (*AccessPolicyAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessPolicyAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessPolicyAssignmentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccessPolicyAssignmentIDInsensitively parses 'input' case-insensitively into a AccessPolicyAssignmentId +// note: this method should only be used for API response data and not user input +func ParseAccessPolicyAssignmentIDInsensitively(input string) (*AccessPolicyAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccessPolicyAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccessPolicyAssignmentId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccessPolicyAssignmentId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) + } + + if id.AccessPolicyAssignmentName, ok = input.Parsed["accessPolicyAssignmentName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyAssignmentName", input) + } + + return nil +} + +// ValidateAccessPolicyAssignmentID checks that 'input' can be parsed as a Access Policy Assignment ID +func ValidateAccessPolicyAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseAccessPolicyAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Access Policy Assignment ID +func (id AccessPolicyAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s/accessPolicyAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName, id.AccessPolicyAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Access Policy Assignment ID +func (id AccessPolicyAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseName"), + resourceids.StaticSegment("staticAccessPolicyAssignments", "accessPolicyAssignments", "accessPolicyAssignments"), + resourceids.UserSpecifiedSegment("accessPolicyAssignmentName", "accessPolicyAssignmentName"), + } +} + +// String returns a human-readable description of this Access Policy Assignment ID +func (id AccessPolicyAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + fmt.Sprintf("Access Policy Assignment Name: %q", id.AccessPolicyAssignmentName), + } + return fmt.Sprintf("Access Policy Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_accesspolicyassignment_test.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_accesspolicyassignment_test.go new file mode 100644 index 00000000000..397b9f0c66d --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_accesspolicyassignment_test.go @@ -0,0 +1,372 @@ +package redisenterprise + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &AccessPolicyAssignmentId{} + +func TestNewAccessPolicyAssignmentID(t *testing.T) { + id := NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName") + + if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { + t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") + } + + if id.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") + } + + if id.DatabaseName != "databaseName" { + t.Fatalf("Expected %q but got %q for Segment 'DatabaseName'", id.DatabaseName, "databaseName") + } + + if id.AccessPolicyAssignmentName != "accessPolicyAssignmentName" { + t.Fatalf("Expected %q but got %q for Segment 'AccessPolicyAssignmentName'", id.AccessPolicyAssignmentName, "accessPolicyAssignmentName") + } +} + +func TestFormatAccessPolicyAssignmentID(t *testing.T) { + actual := NewAccessPolicyAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName", "accessPolicyAssignmentName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccessPolicyAssignmentID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessPolicyAssignmentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", + AccessPolicyAssignmentName: "accessPolicyAssignmentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessPolicyAssignmentID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) + } + + if actual.AccessPolicyAssignmentName != v.Expected.AccessPolicyAssignmentName { + t.Fatalf("Expected %q but got %q for AccessPolicyAssignmentName", v.Expected.AccessPolicyAssignmentName, actual.AccessPolicyAssignmentName) + } + + } +} + +func TestParseAccessPolicyAssignmentIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccessPolicyAssignmentId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", + AccessPolicyAssignmentName: "accessPolicyAssignmentName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/accessPolicyAssignments/accessPolicyAssignmentName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs/aCcEsSpOlIcYaSsIgNmEnTnAmE", + Expected: &AccessPolicyAssignmentId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + DatabaseName: "dAtAbAsEnAmE", + AccessPolicyAssignmentName: "aCcEsSpOlIcYaSsIgNmEnTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/aCcEsSpOlIcYaSsIgNmEnTs/aCcEsSpOlIcYaSsIgNmEnTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccessPolicyAssignmentIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + + if actual.ResourceGroupName != v.Expected.ResourceGroupName { + t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) + } + + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) + } + + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) + } + + if actual.AccessPolicyAssignmentName != v.Expected.AccessPolicyAssignmentName { + t.Fatalf("Expected %q but got %q for AccessPolicyAssignmentName", v.Expected.AccessPolicyAssignmentName, actual.AccessPolicyAssignmentName) + } + + } +} + +func TestSegmentsForAccessPolicyAssignmentId(t *testing.T) { + segments := AccessPolicyAssignmentId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccessPolicyAssignmentId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_database.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_database.go new file mode 100644 index 00000000000..f7352ec7d89 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_database.go @@ -0,0 +1,139 @@ +package redisenterprise + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&DatabaseId{}) +} + +var _ resourceids.ResourceId = &DatabaseId{} + +// DatabaseId is a struct representing the Resource ID for a Database +type DatabaseId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string + DatabaseName string +} + +// NewDatabaseID returns a new DatabaseId struct +func NewDatabaseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string, databaseName string) DatabaseId { + return DatabaseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + DatabaseName: databaseName, + } +} + +// ParseDatabaseID parses 'input' into a DatabaseId +func ParseDatabaseID(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDatabaseIDInsensitively parses 'input' case-insensitively into a DatabaseId +// note: this method should only be used for API response data and not user input +func ParseDatabaseIDInsensitively(input string) (*DatabaseId, error) { + parser := resourceids.NewParserFromResourceIdType(&DatabaseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DatabaseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DatabaseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + if id.DatabaseName, ok = input.Parsed["databaseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "databaseName", input) + } + + return nil +} + +// ValidateDatabaseID checks that 'input' can be parsed as a Database ID +func ValidateDatabaseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseDatabaseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Database ID +func (id DatabaseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s/databases/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName, id.DatabaseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Database ID +func (id DatabaseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + resourceids.StaticSegment("staticDatabases", "databases", "databases"), + resourceids.UserSpecifiedSegment("databaseName", "databaseName"), + } +} + +// String returns a human-readable description of this Database ID +func (id DatabaseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + fmt.Sprintf("Database Name: %q", id.DatabaseName), + } + return fmt.Sprintf("Database (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule_test.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_database_test.go similarity index 61% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule_test.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/id_database_test.go index 08ba6afe7ce..ec9168fdb8c 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule_test.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_database_test.go @@ -1,4 +1,4 @@ -package edgemodules +package redisenterprise import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &EdgeModuleId{} +var _ resourceids.ResourceId = &DatabaseId{} -func TestNewEdgeModuleID(t *testing.T) { - id := NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "edgeModuleName") +func TestNewDatabaseID(t *testing.T) { + id := NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,28 +22,28 @@ func TestNewEdgeModuleID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VideoAnalyzerName != "videoAnalyzerName" { - t.Fatalf("Expected %q but got %q for Segment 'VideoAnalyzerName'", id.VideoAnalyzerName, "videoAnalyzerName") + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") } - if id.EdgeModuleName != "edgeModuleName" { - t.Fatalf("Expected %q but got %q for Segment 'EdgeModuleName'", id.EdgeModuleName, "edgeModuleName") + if id.DatabaseName != "databaseName" { + t.Fatalf("Expected %q but got %q for Segment 'DatabaseName'", id.DatabaseName, "databaseName") } } -func TestFormatEdgeModuleID(t *testing.T) { - actual := NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "edgeModuleName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/edgeModules/edgeModuleName" +func TestFormatDatabaseID(t *testing.T) { + actual := NewDatabaseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName", "databaseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseEdgeModuleID(t *testing.T) { +func TestParseDatabaseID(t *testing.T) { testData := []struct { Input string Error bool - Expected *EdgeModuleId + Expected *DatabaseId }{ { // Incomplete URI @@ -77,44 +77,44 @@ func TestParseEdgeModuleID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/edgeModules", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/edgeModules/edgeModuleName", - Expected: &EdgeModuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", - EdgeModuleName: "edgeModuleName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/edgeModules/edgeModuleName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseEdgeModuleID(v.Input) + actual, err := ParseDatabaseID(v.Input) if err != nil { if v.Error { continue @@ -134,22 +134,22 @@ func TestParseEdgeModuleID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } - if actual.EdgeModuleName != v.Expected.EdgeModuleName { - t.Fatalf("Expected %q but got %q for EdgeModuleName", v.Expected.EdgeModuleName, actual.EdgeModuleName) + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) } } } -func TestParseEdgeModuleIDInsensitively(t *testing.T) { +func TestParseDatabaseIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *EdgeModuleId + Expected *DatabaseId }{ { // Incomplete URI @@ -208,79 +208,79 @@ func TestParseEdgeModuleIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/edgeModules", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/eDgEmOdUlEs", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/edgeModules/edgeModuleName", - Expected: &EdgeModuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", - EdgeModuleName: "edgeModuleName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", + DatabaseName: "databaseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/edgeModules/edgeModuleName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/databases/databaseName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/eDgEmOdUlEs/eDgEmOdUlEnAmE", - Expected: &EdgeModuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VideoAnalyzerName: "vIdEoAnAlYzErNaMe", - EdgeModuleName: "eDgEmOdUlEnAmE", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE", + Expected: &DatabaseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", + DatabaseName: "dAtAbAsEnAmE", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/eDgEmOdUlEs/eDgEmOdUlEnAmE/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/dAtAbAsEs/dAtAbAsEnAmE/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseEdgeModuleIDInsensitively(v.Input) + actual, err := ParseDatabaseIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -300,21 +300,21 @@ func TestParseEdgeModuleIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } - if actual.EdgeModuleName != v.Expected.EdgeModuleName { - t.Fatalf("Expected %q but got %q for EdgeModuleName", v.Expected.EdgeModuleName, actual.EdgeModuleName) + if actual.DatabaseName != v.Expected.DatabaseName { + t.Fatalf("Expected %q but got %q for DatabaseName", v.Expected.DatabaseName, actual.DatabaseName) } } } -func TestSegmentsForEdgeModuleId(t *testing.T) { - segments := EdgeModuleId{}.Segments() +func TestSegmentsForDatabaseId(t *testing.T) { + segments := DatabaseId{}.Segments() if len(segments) == 0 { - t.Fatalf("EdgeModuleId has no segments") + t.Fatalf("DatabaseId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_redisenterprise.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_redisenterprise.go new file mode 100644 index 00000000000..de1d9d9bef2 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_redisenterprise.go @@ -0,0 +1,130 @@ +package redisenterprise + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&RedisEnterpriseId{}) +} + +var _ resourceids.ResourceId = &RedisEnterpriseId{} + +// RedisEnterpriseId is a struct representing the Resource ID for a Redis Enterprise +type RedisEnterpriseId struct { + SubscriptionId string + ResourceGroupName string + RedisEnterpriseName string +} + +// NewRedisEnterpriseID returns a new RedisEnterpriseId struct +func NewRedisEnterpriseID(subscriptionId string, resourceGroupName string, redisEnterpriseName string) RedisEnterpriseId { + return RedisEnterpriseId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RedisEnterpriseName: redisEnterpriseName, + } +} + +// ParseRedisEnterpriseID parses 'input' into a RedisEnterpriseId +func ParseRedisEnterpriseID(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRedisEnterpriseIDInsensitively parses 'input' case-insensitively into a RedisEnterpriseId +// note: this method should only be used for API response data and not user input +func ParseRedisEnterpriseIDInsensitively(input string) (*RedisEnterpriseId, error) { + parser := resourceids.NewParserFromResourceIdType(&RedisEnterpriseId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RedisEnterpriseId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RedisEnterpriseId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.RedisEnterpriseName, ok = input.Parsed["redisEnterpriseName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "redisEnterpriseName", input) + } + + return nil +} + +// ValidateRedisEnterpriseID checks that 'input' can be parsed as a Redis Enterprise ID +func ValidateRedisEnterpriseID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseRedisEnterpriseID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Redis Enterprise ID +func (id RedisEnterpriseId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Cache/redisEnterprise/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RedisEnterpriseName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Redis Enterprise ID +func (id RedisEnterpriseId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCache", "Microsoft.Cache", "Microsoft.Cache"), + resourceids.StaticSegment("staticRedisEnterprise", "redisEnterprise", "redisEnterprise"), + resourceids.UserSpecifiedSegment("redisEnterpriseName", "redisEnterpriseName"), + } +} + +// String returns a human-readable description of this Redis Enterprise ID +func (id RedisEnterpriseId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Redis Enterprise Name: %q", id.RedisEnterpriseName), + } + return fmt.Sprintf("Redis Enterprise (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer_test.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_redisenterprise_test.go similarity index 66% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer_test.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/id_redisenterprise_test.go index fd293814329..8676cc8523e 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer_test.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/id_redisenterprise_test.go @@ -1,4 +1,4 @@ -package edgemodules +package redisenterprise import ( "testing" @@ -9,10 +9,10 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -var _ resourceids.ResourceId = &VideoAnalyzerId{} +var _ resourceids.ResourceId = &RedisEnterpriseId{} -func TestNewVideoAnalyzerID(t *testing.T) { - id := NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") +func TestNewRedisEnterpriseID(t *testing.T) { + id := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName") if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") @@ -22,24 +22,24 @@ func TestNewVideoAnalyzerID(t *testing.T) { t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") } - if id.VideoAnalyzerName != "videoAnalyzerName" { - t.Fatalf("Expected %q but got %q for Segment 'VideoAnalyzerName'", id.VideoAnalyzerName, "videoAnalyzerName") + if id.RedisEnterpriseName != "redisEnterpriseName" { + t.Fatalf("Expected %q but got %q for Segment 'RedisEnterpriseName'", id.RedisEnterpriseName, "redisEnterpriseName") } } -func TestFormatVideoAnalyzerID(t *testing.T) { - actual := NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName" +func TestFormatRedisEnterpriseID(t *testing.T) { + actual := NewRedisEnterpriseID("12345678-1234-9876-4563-123456789012", "example-resource-group", "redisEnterpriseName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName" if actual != expected { t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) } } -func TestParseVideoAnalyzerID(t *testing.T) { +func TestParseRedisEnterpriseID(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoAnalyzerId + Expected *RedisEnterpriseId }{ { // Incomplete URI @@ -73,33 +73,33 @@ func TestParseVideoAnalyzerID(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoAnalyzerID(v.Input) + actual, err := ParseRedisEnterpriseID(v.Input) if err != nil { if v.Error { continue @@ -119,18 +119,18 @@ func TestParseVideoAnalyzerID(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } } } -func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { +func TestParseRedisEnterpriseIDInsensitively(t *testing.T) { testData := []struct { Input string Error bool - Expected *VideoAnalyzerId + Expected *RedisEnterpriseId }{ { // Incomplete URI @@ -189,57 +189,57 @@ func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe", Error: true, }, { // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise", Error: true, }, { // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe", Error: true, }, { // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - VideoAnalyzerName: "videoAnalyzerName", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RedisEnterpriseName: "redisEnterpriseName", }, }, { // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Media/videoAnalyzers/videoAnalyzerName/extra", + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Cache/redisEnterprise/redisEnterpriseName/extra", Error: true, }, { // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe", - Expected: &VideoAnalyzerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - VideoAnalyzerName: "vIdEoAnAlYzErNaMe", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe", + Expected: &RedisEnterpriseId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RedisEnterpriseName: "rEdIsEnTeRpRiSeNaMe", }, }, { // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.mEdIa/vIdEoAnAlYzErS/vIdEoAnAlYzErNaMe/extra", + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cAcHe/rEdIsEnTeRpRiSe/rEdIsEnTeRpRiSeNaMe/extra", Error: true, }, } for _, v := range testData { t.Logf("[DEBUG] Testing %q", v.Input) - actual, err := ParseVideoAnalyzerIDInsensitively(v.Input) + actual, err := ParseRedisEnterpriseIDInsensitively(v.Input) if err != nil { if v.Error { continue @@ -259,17 +259,17 @@ func TestParseVideoAnalyzerIDInsensitively(t *testing.T) { t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) } - if actual.VideoAnalyzerName != v.Expected.VideoAnalyzerName { - t.Fatalf("Expected %q but got %q for VideoAnalyzerName", v.Expected.VideoAnalyzerName, actual.VideoAnalyzerName) + if actual.RedisEnterpriseName != v.Expected.RedisEnterpriseName { + t.Fatalf("Expected %q but got %q for RedisEnterpriseName", v.Expected.RedisEnterpriseName, actual.RedisEnterpriseName) } } } -func TestSegmentsForVideoAnalyzerId(t *testing.T) { - segments := VideoAnalyzerId{}.Segments() +func TestSegmentsForRedisEnterpriseId(t *testing.T) { + segments := RedisEnterpriseId{}.Segments() if len(segments) == 0 { - t.Fatalf("VideoAnalyzerId has no segments") + t.Fatalf("RedisEnterpriseId has no segments") } uniqueNames := make(map[string]struct{}, 0) diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentcreateupdate.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentcreateupdate.go new file mode 100644 index 00000000000..41586117882 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentcreateupdate.go @@ -0,0 +1,75 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentCreateUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AccessPolicyAssignment +} + +// AccessPolicyAssignmentCreateUpdate ... +func (c RedisEnterpriseClient) AccessPolicyAssignmentCreateUpdate(ctx context.Context, id AccessPolicyAssignmentId, input AccessPolicyAssignment) (result AccessPolicyAssignmentCreateUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AccessPolicyAssignmentCreateUpdateThenPoll performs AccessPolicyAssignmentCreateUpdate then polls until it's completed +func (c RedisEnterpriseClient) AccessPolicyAssignmentCreateUpdateThenPoll(ctx context.Context, id AccessPolicyAssignmentId, input AccessPolicyAssignment) error { + result, err := c.AccessPolicyAssignmentCreateUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccessPolicyAssignmentCreateUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AccessPolicyAssignmentCreateUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentdelete.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentdelete.go new file mode 100644 index 00000000000..fd53ae3692a --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentdelete.go @@ -0,0 +1,70 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// AccessPolicyAssignmentDelete ... +func (c RedisEnterpriseClient) AccessPolicyAssignmentDelete(ctx context.Context, id AccessPolicyAssignmentId) (result AccessPolicyAssignmentDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// AccessPolicyAssignmentDeleteThenPoll performs AccessPolicyAssignmentDelete then polls until it's completed +func (c RedisEnterpriseClient) AccessPolicyAssignmentDeleteThenPoll(ctx context.Context, id AccessPolicyAssignmentId) error { + result, err := c.AccessPolicyAssignmentDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AccessPolicyAssignmentDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AccessPolicyAssignmentDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentget.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentget.go new file mode 100644 index 00000000000..b1bc0f706d7 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentget.go @@ -0,0 +1,53 @@ +package redisenterprise + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessPolicyAssignment +} + +// AccessPolicyAssignmentGet ... +func (c RedisEnterpriseClient) AccessPolicyAssignmentGet(ctx context.Context, id AccessPolicyAssignmentId) (result AccessPolicyAssignmentGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AccessPolicyAssignment + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentlist.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentlist.go new file mode 100644 index 00000000000..7a2b05043bb --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_accesspolicyassignmentlist.go @@ -0,0 +1,105 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AccessPolicyAssignment +} + +type AccessPolicyAssignmentListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AccessPolicyAssignment +} + +type AccessPolicyAssignmentListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *AccessPolicyAssignmentListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// AccessPolicyAssignmentList ... +func (c RedisEnterpriseClient) AccessPolicyAssignmentList(ctx context.Context, id DatabaseId) (result AccessPolicyAssignmentListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &AccessPolicyAssignmentListCustomPager{}, + Path: fmt.Sprintf("%s/accessPolicyAssignments", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]AccessPolicyAssignment `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// AccessPolicyAssignmentListComplete retrieves all the results into a single object +func (c RedisEnterpriseClient) AccessPolicyAssignmentListComplete(ctx context.Context, id DatabaseId) (AccessPolicyAssignmentListCompleteResult, error) { + return c.AccessPolicyAssignmentListCompleteMatchingPredicate(ctx, id, AccessPolicyAssignmentOperationPredicate{}) +} + +// AccessPolicyAssignmentListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RedisEnterpriseClient) AccessPolicyAssignmentListCompleteMatchingPredicate(ctx context.Context, id DatabaseId, predicate AccessPolicyAssignmentOperationPredicate) (result AccessPolicyAssignmentListCompleteResult, err error) { + items := make([]AccessPolicyAssignment, 0) + + resp, err := c.AccessPolicyAssignmentList(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = AccessPolicyAssignmentListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_create.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_create.go new file mode 100644 index 00000000000..bc1b883cbbb --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_create.go @@ -0,0 +1,75 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Cluster +} + +// Create ... +func (c RedisEnterpriseClient) Create(ctx context.Context, id RedisEnterpriseId, input Cluster) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c RedisEnterpriseClient) CreateThenPoll(ctx context.Context, id RedisEnterpriseId, input Cluster) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasescreate.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasescreate.go new file mode 100644 index 00000000000..76933e8f063 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasescreate.go @@ -0,0 +1,75 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesCreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Database +} + +// DatabasesCreate ... +func (c RedisEnterpriseClient) DatabasesCreate(ctx context.Context, id DatabaseId, input Database) (result DatabasesCreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesCreateThenPoll performs DatabasesCreate then polls until it's completed +func (c RedisEnterpriseClient) DatabasesCreateThenPoll(ctx context.Context, id DatabaseId, input Database) error { + result, err := c.DatabasesCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesCreate: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesdelete.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesdelete.go new file mode 100644 index 00000000000..a7961442781 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesdelete.go @@ -0,0 +1,71 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesDelete ... +func (c RedisEnterpriseClient) DatabasesDelete(ctx context.Context, id DatabaseId) (result DatabasesDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesDeleteThenPoll performs DatabasesDelete then polls until it's completed +func (c RedisEnterpriseClient) DatabasesDeleteThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.DatabasesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing DatabasesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesDelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesexport.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesexport.go new file mode 100644 index 00000000000..8ce4d87e186 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesexport.go @@ -0,0 +1,74 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesExportOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesExport ... +func (c RedisEnterpriseClient) DatabasesExport(ctx context.Context, id DatabaseId, input ExportClusterParameters) (result DatabasesExportOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/export", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesExportThenPoll performs DatabasesExport then polls until it's completed +func (c RedisEnterpriseClient) DatabasesExportThenPoll(ctx context.Context, id DatabaseId, input ExportClusterParameters) error { + result, err := c.DatabasesExport(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesExport: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesExport: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesflush.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesflush.go new file mode 100644 index 00000000000..1a2453ebee2 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesflush.go @@ -0,0 +1,74 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesFlushOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesFlush ... +func (c RedisEnterpriseClient) DatabasesFlush(ctx context.Context, id DatabaseId, input FlushParameters) (result DatabasesFlushOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/flush", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesFlushThenPoll performs DatabasesFlush then polls until it's completed +func (c RedisEnterpriseClient) DatabasesFlushThenPoll(ctx context.Context, id DatabaseId, input FlushParameters) error { + result, err := c.DatabasesFlush(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesFlush: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesFlush: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesforcelinktoreplicationgroup.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesforcelinktoreplicationgroup.go new file mode 100644 index 00000000000..2a6994912d6 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesforcelinktoreplicationgroup.go @@ -0,0 +1,73 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesForceLinkToReplicationGroupOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesForceLinkToReplicationGroup ... +func (c RedisEnterpriseClient) DatabasesForceLinkToReplicationGroup(ctx context.Context, id DatabaseId, input ForceLinkParameters) (result DatabasesForceLinkToReplicationGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/forceLinkToReplicationGroup", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesForceLinkToReplicationGroupThenPoll performs DatabasesForceLinkToReplicationGroup then polls until it's completed +func (c RedisEnterpriseClient) DatabasesForceLinkToReplicationGroupThenPoll(ctx context.Context, id DatabaseId, input ForceLinkParameters) error { + result, err := c.DatabasesForceLinkToReplicationGroup(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesForceLinkToReplicationGroup: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesForceLinkToReplicationGroup: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesforceunlink.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesforceunlink.go new file mode 100644 index 00000000000..1fc0801e823 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesforceunlink.go @@ -0,0 +1,74 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesForceUnlinkOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesForceUnlink ... +func (c RedisEnterpriseClient) DatabasesForceUnlink(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) (result DatabasesForceUnlinkOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/forceUnlink", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesForceUnlinkThenPoll performs DatabasesForceUnlink then polls until it's completed +func (c RedisEnterpriseClient) DatabasesForceUnlinkThenPoll(ctx context.Context, id DatabaseId, input ForceUnlinkParameters) error { + result, err := c.DatabasesForceUnlink(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesForceUnlink: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesForceUnlink: %+v", err) + } + + return nil +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesget.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesget.go similarity index 75% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesget.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesget.go index 1c7be3e4872..f774a726917 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesget.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesget.go @@ -1,4 +1,4 @@ -package videos +package redisenterprise import ( "context" @@ -11,14 +11,14 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type AccessPoliciesGetOperationResponse struct { +type DatabasesGetOperationResponse struct { HttpResponse *http.Response OData *odata.OData - Model *AccessPolicyEntity + Model *Database } -// AccessPoliciesGet ... -func (c VideosClient) AccessPoliciesGet(ctx context.Context, id AccessPolicyId) (result AccessPoliciesGetOperationResponse, err error) { +// DatabasesGet ... +func (c RedisEnterpriseClient) DatabasesGet(ctx context.Context, id DatabaseId) (result DatabasesGetOperationResponse, err error) { opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ @@ -43,7 +43,7 @@ func (c VideosClient) AccessPoliciesGet(ctx context.Context, id AccessPolicyId) return } - var model AccessPolicyEntity + var model Database result.Model = &model if err = resp.Unmarshal(result.Model); err != nil { return diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesimport.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesimport.go new file mode 100644 index 00000000000..08fff384eb6 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesimport.go @@ -0,0 +1,74 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesImportOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesImport ... +func (c RedisEnterpriseClient) DatabasesImport(ctx context.Context, id DatabaseId, input ImportClusterParameters) (result DatabasesImportOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/import", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesImportThenPoll performs DatabasesImport then polls until it's completed +func (c RedisEnterpriseClient) DatabasesImportThenPoll(ctx context.Context, id DatabaseId, input ImportClusterParameters) error { + result, err := c.DatabasesImport(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesImport: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesImport: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databaseslistbycluster.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databaseslistbycluster.go new file mode 100644 index 00000000000..b8af4ecf22a --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databaseslistbycluster.go @@ -0,0 +1,105 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesListByClusterOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Database +} + +type DatabasesListByClusterCompleteResult struct { + LatestHttpResponse *http.Response + Items []Database +} + +type DatabasesListByClusterCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *DatabasesListByClusterCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// DatabasesListByCluster ... +func (c RedisEnterpriseClient) DatabasesListByCluster(ctx context.Context, id RedisEnterpriseId) (result DatabasesListByClusterOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &DatabasesListByClusterCustomPager{}, + Path: fmt.Sprintf("%s/databases", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Database `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// DatabasesListByClusterComplete retrieves all the results into a single object +func (c RedisEnterpriseClient) DatabasesListByClusterComplete(ctx context.Context, id RedisEnterpriseId) (DatabasesListByClusterCompleteResult, error) { + return c.DatabasesListByClusterCompleteMatchingPredicate(ctx, id, DatabaseOperationPredicate{}) +} + +// DatabasesListByClusterCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RedisEnterpriseClient) DatabasesListByClusterCompleteMatchingPredicate(ctx context.Context, id RedisEnterpriseId, predicate DatabaseOperationPredicate) (result DatabasesListByClusterCompleteResult, err error) { + items := make([]Database, 0) + + resp, err := c.DatabasesListByCluster(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = DatabasesListByClusterCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosliststreamingtoken.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databaseslistkeys.go similarity index 69% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosliststreamingtoken.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databaseslistkeys.go index 6d1a409531a..0232e662380 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosliststreamingtoken.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databaseslistkeys.go @@ -1,4 +1,4 @@ -package videos +package redisenterprise import ( "context" @@ -12,21 +12,21 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideosListStreamingTokenOperationResponse struct { +type DatabasesListKeysOperationResponse struct { HttpResponse *http.Response OData *odata.OData - Model *VideoStreamingToken + Model *AccessKeys } -// VideosListStreamingToken ... -func (c VideosClient) VideosListStreamingToken(ctx context.Context, id VideoId) (result VideosListStreamingTokenOperationResponse, err error) { +// DatabasesListKeys ... +func (c RedisEnterpriseClient) DatabasesListKeys(ctx context.Context, id DatabaseId) (result DatabasesListKeysOperationResponse, err error) { opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ http.StatusOK, }, HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/listStreamingToken", id.ID()), + Path: fmt.Sprintf("%s/listKeys", id.ID()), } req, err := c.Client.NewRequest(ctx, opts) @@ -44,7 +44,7 @@ func (c VideosClient) VideosListStreamingToken(ctx context.Context, id VideoId) return } - var model VideoStreamingToken + var model AccessKeys result.Model = &model if err = resp.Unmarshal(result.Model); err != nil { return diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesregeneratekey.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesregeneratekey.go new file mode 100644 index 00000000000..62dc26cf6ea --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesregeneratekey.go @@ -0,0 +1,75 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesRegenerateKeyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *AccessKeys +} + +// DatabasesRegenerateKey ... +func (c RedisEnterpriseClient) DatabasesRegenerateKey(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) (result DatabasesRegenerateKeyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/regenerateKey", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesRegenerateKeyThenPoll performs DatabasesRegenerateKey then polls until it's completed +func (c RedisEnterpriseClient) DatabasesRegenerateKeyThenPoll(ctx context.Context, id DatabaseId, input RegenerateKeyParameters) error { + result, err := c.DatabasesRegenerateKey(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesRegenerateKey: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesRegenerateKey: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesupdate.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesupdate.go new file mode 100644 index 00000000000..2b0e7934d93 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesupdate.go @@ -0,0 +1,75 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Database +} + +// DatabasesUpdate ... +func (c RedisEnterpriseClient) DatabasesUpdate(ctx context.Context, id DatabaseId, input DatabaseUpdate) (result DatabasesUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesUpdateThenPoll performs DatabasesUpdate then polls until it's completed +func (c RedisEnterpriseClient) DatabasesUpdateThenPoll(ctx context.Context, id DatabaseId, input DatabaseUpdate) error { + result, err := c.DatabasesUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DatabasesUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesupgradedbredisversion.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesupgradedbredisversion.go new file mode 100644 index 00000000000..5c3e29659ac --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_databasesupgradedbredisversion.go @@ -0,0 +1,69 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabasesUpgradeDBRedisVersionOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DatabasesUpgradeDBRedisVersion ... +func (c RedisEnterpriseClient) DatabasesUpgradeDBRedisVersion(ctx context.Context, id DatabaseId) (result DatabasesUpgradeDBRedisVersionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/upgradeDBRedisVersion", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DatabasesUpgradeDBRedisVersionThenPoll performs DatabasesUpgradeDBRedisVersion then polls until it's completed +func (c RedisEnterpriseClient) DatabasesUpgradeDBRedisVersionThenPoll(ctx context.Context, id DatabaseId) error { + result, err := c.DatabasesUpgradeDBRedisVersion(ctx, id) + if err != nil { + return fmt.Errorf("performing DatabasesUpgradeDBRedisVersion: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DatabasesUpgradeDBRedisVersion: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_delete.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_delete.go new file mode 100644 index 00000000000..d15634da2c0 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_delete.go @@ -0,0 +1,71 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c RedisEnterpriseClient) Delete(ctx context.Context, id RedisEnterpriseId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c RedisEnterpriseClient) DeleteThenPoll(ctx context.Context, id RedisEnterpriseId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosget.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_get.go similarity index 78% rename from resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosget.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/method_get.go index fe28a4cb1a4..c729b30e660 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosget.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_get.go @@ -1,4 +1,4 @@ -package videos +package redisenterprise import ( "context" @@ -11,14 +11,14 @@ import ( // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideosGetOperationResponse struct { +type GetOperationResponse struct { HttpResponse *http.Response OData *odata.OData - Model *VideoEntity + Model *Cluster } -// VideosGet ... -func (c VideosClient) VideosGet(ctx context.Context, id VideoId) (result VideosGetOperationResponse, err error) { +// Get ... +func (c RedisEnterpriseClient) Get(ctx context.Context, id RedisEnterpriseId) (result GetOperationResponse, err error) { opts := client.RequestOptions{ ContentType: "application/json; charset=utf-8", ExpectedStatusCodes: []int{ @@ -43,7 +43,7 @@ func (c VideosClient) VideosGet(ctx context.Context, id VideoId) (result VideosG return } - var model VideoEntity + var model Cluster result.Model = &model if err = resp.Unmarshal(result.Model); err != nil { return diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_list.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_list.go new file mode 100644 index 00000000000..b3062bf1802 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_list.go @@ -0,0 +1,106 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Cluster +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Cluster +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c RedisEnterpriseClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Cache/redisEnterprise", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Cluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListComplete retrieves all the results into a single object +func (c RedisEnterpriseClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RedisEnterpriseClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ClusterOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Cluster, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_listbyresourcegroup.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_listbyresourcegroup.go new file mode 100644 index 00000000000..181676b5089 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Cluster +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Cluster +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c RedisEnterpriseClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Cache/redisEnterprise", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Cluster `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c RedisEnterpriseClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ClusterOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RedisEnterpriseClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ClusterOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Cluster, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_listskusforscaling.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_listskusforscaling.go new file mode 100644 index 00000000000..832ff19ba57 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_listskusforscaling.go @@ -0,0 +1,54 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListSkusForScalingOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SkuDetailsList +} + +// ListSkusForScaling ... +func (c RedisEnterpriseClient) ListSkusForScaling(ctx context.Context, id RedisEnterpriseId) (result ListSkusForScalingOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/listSkusForScaling", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SkuDetailsList + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_update.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_update.go new file mode 100644 index 00000000000..e23cde29632 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/method_update.go @@ -0,0 +1,75 @@ +package redisenterprise + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Cluster +} + +// Update ... +func (c RedisEnterpriseClient) Update(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c RedisEnterpriseClient) UpdateThenPoll(ctx context.Context, id RedisEnterpriseId, input ClusterUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesskeys.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesskeys.go new file mode 100644 index 00000000000..79566de711f --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesskeys.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessKeys struct { + PrimaryKey *string `json:"primaryKey,omitempty"` + SecondaryKey *string `json:"secondaryKey,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignment.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignment.go new file mode 100644 index 00000000000..0b0a3710006 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignment.go @@ -0,0 +1,11 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignment struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccessPolicyAssignmentProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignmentproperties.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignmentproperties.go new file mode 100644 index 00000000000..30b569d150a --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignmentproperties.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentProperties struct { + AccessPolicyName string `json:"accessPolicyName"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + User AccessPolicyAssignmentPropertiesUser `json:"user"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignmentpropertiesuser.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignmentpropertiesuser.go new file mode 100644 index 00000000000..9e3ea3ec6fb --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_accesspolicyassignmentpropertiesuser.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentPropertiesUser struct { + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_cluster.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_cluster.go new file mode 100644 index 00000000000..363c49dad8d --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_cluster.go @@ -0,0 +1,22 @@ +package redisenterprise + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Cluster struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Kind *Kind `json:"kind,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ClusterCreateProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryption.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryption.go new file mode 100644 index 00000000000..c92f88ff311 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryption.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterCommonPropertiesEncryption struct { + CustomerManagedKeyEncryption *ClusterCommonPropertiesEncryptionCustomerManagedKeyEncryption `json:"customerManagedKeyEncryption,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryptioncustomermanagedkeyencryption.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryptioncustomermanagedkeyencryption.go new file mode 100644 index 00000000000..6b12e5f0a87 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryptioncustomermanagedkeyencryption.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterCommonPropertiesEncryptionCustomerManagedKeyEncryption struct { + KeyEncryptionKeyIdentity *ClusterCommonPropertiesEncryptionCustomerManagedKeyEncryptionKeyEncryptionKeyIdentity `json:"keyEncryptionKeyIdentity,omitempty"` + KeyEncryptionKeyURL *string `json:"keyEncryptionKeyUrl,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryptioncustomermanagedkeyencryptionkeyencryptionkeyidentity.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryptioncustomermanagedkeyencryptionkeyencryptionkeyidentity.go new file mode 100644 index 00000000000..8c5f42a8c01 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercommonpropertiesencryptioncustomermanagedkeyencryptionkeyencryptionkeyidentity.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterCommonPropertiesEncryptionCustomerManagedKeyEncryptionKeyEncryptionKeyIdentity struct { + IdentityType *CmkIdentityType `json:"identityType,omitempty"` + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercreateproperties.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercreateproperties.go new file mode 100644 index 00000000000..63482ced8bf --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clustercreateproperties.go @@ -0,0 +1,17 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterCreateProperties struct { + Encryption *ClusterCommonPropertiesEncryption `json:"encryption,omitempty"` + HighAvailability *HighAvailability `json:"highAvailability,omitempty"` + HostName *string `json:"hostName,omitempty"` + MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess"` + RedisVersion *string `json:"redisVersion,omitempty"` + RedundancyMode *RedundancyMode `json:"redundancyMode,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clusterupdate.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clusterupdate.go new file mode 100644 index 00000000000..795a340f44d --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clusterupdate.go @@ -0,0 +1,15 @@ +package redisenterprise + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdate struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Properties *ClusterUpdateProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clusterupdateproperties.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clusterupdateproperties.go new file mode 100644 index 00000000000..b6f2db03aa7 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_clusterupdateproperties.go @@ -0,0 +1,17 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClusterUpdateProperties struct { + Encryption *ClusterCommonPropertiesEncryption `json:"encryption,omitempty"` + HighAvailability *HighAvailability `json:"highAvailability,omitempty"` + HostName *string `json:"hostName,omitempty"` + MinimumTlsVersion *TlsVersion `json:"minimumTlsVersion,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + RedundancyMode *RedundancyMode `json:"redundancyMode,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_database.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_database.go new file mode 100644 index 00000000000..72fad26191e --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_database.go @@ -0,0 +1,11 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Database struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DatabaseCreateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databasecommonpropertiesgeoreplication.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databasecommonpropertiesgeoreplication.go new file mode 100644 index 00000000000..1d0ecb6253e --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databasecommonpropertiesgeoreplication.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseCommonPropertiesGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databasecreateproperties.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databasecreateproperties.go new file mode 100644 index 00000000000..ab1b9ab772e --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databasecreateproperties.go @@ -0,0 +1,19 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseCreateProperties struct { + AccessKeysAuthentication *AccessKeysAuthentication `json:"accessKeysAuthentication,omitempty"` + ClientProtocol *Protocol `json:"clientProtocol,omitempty"` + ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + DeferUpgrade *DeferUpgradeSetting `json:"deferUpgrade,omitempty"` + EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` + GeoReplication *DatabaseCommonPropertiesGeoReplication `json:"geoReplication,omitempty"` + Modules *[]Module `json:"modules,omitempty"` + Persistence *Persistence `json:"persistence,omitempty"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databaseupdate.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databaseupdate.go new file mode 100644 index 00000000000..195d71d9c69 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databaseupdate.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseUpdate struct { + Properties *DatabaseUpdateProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databaseupdateproperties.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databaseupdateproperties.go new file mode 100644 index 00000000000..2721ba4b6c3 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_databaseupdateproperties.go @@ -0,0 +1,19 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DatabaseUpdateProperties struct { + AccessKeysAuthentication *AccessKeysAuthentication `json:"accessKeysAuthentication,omitempty"` + ClientProtocol *Protocol `json:"clientProtocol,omitempty"` + ClusteringPolicy *ClusteringPolicy `json:"clusteringPolicy,omitempty"` + DeferUpgrade *DeferUpgradeSetting `json:"deferUpgrade,omitempty"` + EvictionPolicy *EvictionPolicy `json:"evictionPolicy,omitempty"` + GeoReplication *DatabaseCommonPropertiesGeoReplication `json:"geoReplication,omitempty"` + Modules *[]Module `json:"modules,omitempty"` + Persistence *Persistence `json:"persistence,omitempty"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + RedisVersion *string `json:"redisVersion,omitempty"` + ResourceState *ResourceState `json:"resourceState,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_exportclusterparameters.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_exportclusterparameters.go new file mode 100644 index 00000000000..d6ba54aa230 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_exportclusterparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportClusterParameters struct { + SasUri string `json:"sasUri"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_flushparameters.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_flushparameters.go new file mode 100644 index 00000000000..9d3358ea741 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_flushparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type FlushParameters struct { + Ids *[]string `json:"ids,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forcelinkparameters.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forcelinkparameters.go new file mode 100644 index 00000000000..b80b6aaf76b --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forcelinkparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceLinkParameters struct { + GeoReplication ForceLinkParametersGeoReplication `json:"geoReplication"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forcelinkparametersgeoreplication.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forcelinkparametersgeoreplication.go new file mode 100644 index 00000000000..53242cf971b --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forcelinkparametersgeoreplication.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceLinkParametersGeoReplication struct { + GroupNickname *string `json:"groupNickname,omitempty"` + LinkedDatabases *[]LinkedDatabase `json:"linkedDatabases,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forceunlinkparameters.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forceunlinkparameters.go new file mode 100644 index 00000000000..7bf82a13709 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_forceunlinkparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ForceUnlinkParameters struct { + Ids []string `json:"ids"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_importclusterparameters.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_importclusterparameters.go new file mode 100644 index 00000000000..11e13cd4dc4 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_importclusterparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImportClusterParameters struct { + SasUris []string `json:"sasUris"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_linkeddatabase.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_linkeddatabase.go new file mode 100644 index 00000000000..02abc0422ce --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_linkeddatabase.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkedDatabase struct { + Id *string `json:"id,omitempty"` + State *LinkState `json:"state,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_module.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_module.go new file mode 100644 index 00000000000..99bd8473a0f --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_module.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Module struct { + Args *string `json:"args,omitempty"` + Name string `json:"name"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_persistence.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_persistence.go new file mode 100644 index 00000000000..3b7b30f2fb9 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_persistence.go @@ -0,0 +1,11 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Persistence struct { + AofEnabled *bool `json:"aofEnabled,omitempty"` + AofFrequency *AofFrequency `json:"aofFrequency,omitempty"` + RdbEnabled *bool `json:"rdbEnabled,omitempty"` + RdbFrequency *RdbFrequency `json:"rdbFrequency,omitempty"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_syncstoragekeysinput.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpoint.go similarity index 76% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_syncstoragekeysinput.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpoint.go index c38b61caf49..e15699fe1d1 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_syncstoragekeysinput.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpoint.go @@ -1,8 +1,8 @@ -package videoanalyzers +package redisenterprise // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type SyncStorageKeysInput struct { +type PrivateEndpoint struct { Id *string `json:"id,omitempty"` } diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnection.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnection.go new file mode 100644 index 00000000000..5da2f77534d --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnectionproperties.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..9ebfbe2d3c2 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnectionproperties.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privatelinkserviceconnectionstate.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..abb658aee84 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_regeneratekeyparameters.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_regeneratekeyparameters.go new file mode 100644 index 00000000000..2d44026dd91 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_regeneratekeyparameters.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RegenerateKeyParameters struct { + KeyType AccessKeyType `json:"keyType"` +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzercollection.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_sku.go similarity index 57% rename from resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzercollection.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/model_sku.go index 100e14e5a13..740c3615e0c 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzercollection.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_sku.go @@ -1,8 +1,9 @@ -package videoanalyzers +package redisenterprise // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -type VideoAnalyzerCollection struct { - Value *[]VideoAnalyzer `json:"value,omitempty"` +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name SkuName `json:"name"` } diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_skudetails.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_skudetails.go new file mode 100644 index 00000000000..3b2d547da02 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_skudetails.go @@ -0,0 +1,9 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuDetails struct { + Name *string `json:"name,omitempty"` + SizeInGB *float64 `json:"sizeInGB,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_skudetailslist.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_skudetailslist.go new file mode 100644 index 00000000000..11d1414a489 --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_skudetailslist.go @@ -0,0 +1,8 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuDetailsList struct { + Skus *[]SkuDetails `json:"skus,omitempty"` +} diff --git a/resource-manager/redisenterprise/2025-07-01/redisenterprise/predicates.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/predicates.go new file mode 100644 index 00000000000..ae97e32ba4c --- /dev/null +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/predicates.go @@ -0,0 +1,78 @@ +package redisenterprise + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessPolicyAssignmentOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p AccessPolicyAssignmentOperationPredicate) Matches(input AccessPolicyAssignment) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type ClusterOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ClusterOperationPredicate) Matches(input Cluster) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type DatabaseOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DatabaseOperationPredicate) Matches(input Database) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/version.go b/resource-manager/redisenterprise/2025-07-01/redisenterprise/version.go similarity index 58% rename from resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/version.go rename to resource-manager/redisenterprise/2025-07-01/redisenterprise/version.go index 3d7af0ff5f7..e229b992c49 100644 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/version.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/version.go @@ -1,10 +1,10 @@ -package edgemodules +package redisenterprise // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2021-05-01-preview" +const defaultApiVersion = "2025-07-01" func userAgent() string { - return "hashicorp/go-azure-sdk/edgemodules/2021-05-01-preview" + return "hashicorp/go-azure-sdk/redisenterprise/2025-07-01" } diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/client.go b/resource-manager/videoanalyzer/2021-05-01-preview/client.go deleted file mode 100644 index 3f7c26d6544..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/client.go +++ /dev/null @@ -1,46 +0,0 @@ -package v2021_05_01_preview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -import ( - "fmt" - - "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules" - "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers" - "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videos" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" -) - -type Client struct { - EdgeModules *edgemodules.EdgeModulesClient - VideoAnalyzers *videoanalyzers.VideoAnalyzersClient - Videos *videos.VideosClient -} - -func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { - edgeModulesClient, err := edgemodules.NewEdgeModulesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building EdgeModules client: %+v", err) - } - configureFunc(edgeModulesClient.Client) - - videoAnalyzersClient, err := videoanalyzers.NewVideoAnalyzersClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VideoAnalyzers client: %+v", err) - } - configureFunc(videoAnalyzersClient.Client) - - videosClient, err := videos.NewVideosClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Videos client: %+v", err) - } - configureFunc(videosClient.Client) - - return &Client{ - EdgeModules: edgeModulesClient, - VideoAnalyzers: videoAnalyzersClient, - Videos: videosClient, - }, nil -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md deleted file mode 100644 index e6af17a21c6..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules` Documentation - -The `edgemodules` SDK allows for interaction with Azure Resource Manager `videoanalyzer` (API Version `2021-05-01-preview`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules" -``` - - -### Client Initialization - -```go -client := edgemodules.NewEdgeModulesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `EdgeModulesClient.CreateOrUpdate` - -```go -ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "edgeModuleName") - -payload := edgemodules.EdgeModuleEntity{ - // ... -} - - -read, err := client.CreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EdgeModulesClient.Delete` - -```go -ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "edgeModuleName") - -read, err := client.Delete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EdgeModulesClient.Get` - -```go -ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "edgeModuleName") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `EdgeModulesClient.List` - -```go -ctx := context.TODO() -id := edgemodules.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -// alternatively `client.List(ctx, id, edgemodules.DefaultListOperationOptions())` can be used to do batched pagination -items, err := client.ListComplete(ctx, id, edgemodules.DefaultListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `EdgeModulesClient.ListProvisioningToken` - -```go -ctx := context.TODO() -id := edgemodules.NewEdgeModuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "edgeModuleName") - -payload := edgemodules.ListProvisioningTokenInput{ - // ... -} - - -read, err := client.ListProvisioningToken(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go deleted file mode 100644 index f34fe1cd97b..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_edgemodule.go +++ /dev/null @@ -1,139 +0,0 @@ -package edgemodules - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&EdgeModuleId{}) -} - -var _ resourceids.ResourceId = &EdgeModuleId{} - -// EdgeModuleId is a struct representing the Resource ID for a Edge Module -type EdgeModuleId struct { - SubscriptionId string - ResourceGroupName string - VideoAnalyzerName string - EdgeModuleName string -} - -// NewEdgeModuleID returns a new EdgeModuleId struct -func NewEdgeModuleID(subscriptionId string, resourceGroupName string, videoAnalyzerName string, edgeModuleName string) EdgeModuleId { - return EdgeModuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VideoAnalyzerName: videoAnalyzerName, - EdgeModuleName: edgeModuleName, - } -} - -// ParseEdgeModuleID parses 'input' into a EdgeModuleId -func ParseEdgeModuleID(input string) (*EdgeModuleId, error) { - parser := resourceids.NewParserFromResourceIdType(&EdgeModuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := EdgeModuleId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseEdgeModuleIDInsensitively parses 'input' case-insensitively into a EdgeModuleId -// note: this method should only be used for API response data and not user input -func ParseEdgeModuleIDInsensitively(input string) (*EdgeModuleId, error) { - parser := resourceids.NewParserFromResourceIdType(&EdgeModuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := EdgeModuleId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *EdgeModuleId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) - } - - if id.EdgeModuleName, ok = input.Parsed["edgeModuleName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "edgeModuleName", input) - } - - return nil -} - -// ValidateEdgeModuleID checks that 'input' can be parsed as a Edge Module ID -func ValidateEdgeModuleID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseEdgeModuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Edge Module ID -func (id EdgeModuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s/edgeModules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName, id.EdgeModuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Edge Module ID -func (id EdgeModuleId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerName"), - resourceids.StaticSegment("staticEdgeModules", "edgeModules", "edgeModules"), - resourceids.UserSpecifiedSegment("edgeModuleName", "edgeModuleName"), - } -} - -// String returns a human-readable description of this Edge Module ID -func (id EdgeModuleId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), - fmt.Sprintf("Edge Module Name: %q", id.EdgeModuleName), - } - return fmt.Sprintf("Edge Module (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go deleted file mode 100644 index b753f8a57ed..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/id_videoanalyzer.go +++ /dev/null @@ -1,130 +0,0 @@ -package edgemodules - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VideoAnalyzerId{}) -} - -var _ resourceids.ResourceId = &VideoAnalyzerId{} - -// VideoAnalyzerId is a struct representing the Resource ID for a Video Analyzer -type VideoAnalyzerId struct { - SubscriptionId string - ResourceGroupName string - VideoAnalyzerName string -} - -// NewVideoAnalyzerID returns a new VideoAnalyzerId struct -func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, videoAnalyzerName string) VideoAnalyzerId { - return VideoAnalyzerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VideoAnalyzerName: videoAnalyzerName, - } -} - -// ParseVideoAnalyzerID parses 'input' into a VideoAnalyzerId -func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoAnalyzerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoAnalyzerId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVideoAnalyzerIDInsensitively parses 'input' case-insensitively into a VideoAnalyzerId -// note: this method should only be used for API response data and not user input -func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoAnalyzerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoAnalyzerId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VideoAnalyzerId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) - } - - return nil -} - -// ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID -func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVideoAnalyzerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Video Analyzer ID -func (id VideoAnalyzerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID -func (id VideoAnalyzerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerName"), - } -} - -// String returns a human-readable description of this Video Analyzer ID -func (id VideoAnalyzerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), - } - return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_createorupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_createorupdate.go deleted file mode 100644 index 82255e17bd4..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_createorupdate.go +++ /dev/null @@ -1,58 +0,0 @@ -package edgemodules - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *EdgeModuleEntity -} - -// CreateOrUpdate ... -func (c EdgeModulesClient) CreateOrUpdate(ctx context.Context, id EdgeModuleId, input EdgeModuleEntity) (result CreateOrUpdateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusCreated, - http.StatusOK, - }, - HttpMethod: http.MethodPut, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model EdgeModuleEntity - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_list.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_list.go deleted file mode 100644 index ccf4606b493..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_list.go +++ /dev/null @@ -1,142 +0,0 @@ -package edgemodules - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]EdgeModuleEntity -} - -type ListCompleteResult struct { - LatestHttpResponse *http.Response - Items []EdgeModuleEntity -} - -type ListOperationOptions struct { - Filter *string - Orderby *string - Top *int64 -} - -func DefaultListOperationOptions() ListOperationOptions { - return ListOperationOptions{} -} - -func (o ListOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o ListOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - - return &out -} - -func (o ListOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.Filter != nil { - out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) - } - if o.Orderby != nil { - out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) - } - if o.Top != nil { - out.Append("$top", fmt.Sprintf("%v", *o.Top)) - } - return &out -} - -type ListCustomPager struct { - NextLink *odata.Link `json:"@nextLink"` -} - -func (p *ListCustomPager) NextPageLink() *odata.Link { - defer func() { - p.NextLink = nil - }() - - return p.NextLink -} - -// List ... -func (c EdgeModulesClient) List(ctx context.Context, id VideoAnalyzerId, options ListOperationOptions) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - OptionsObject: options, - Pager: &ListCustomPager{}, - Path: fmt.Sprintf("%s/edgeModules", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.ExecutePaged(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var values struct { - Values *[]EdgeModuleEntity `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListComplete retrieves all the results into a single object -func (c EdgeModulesClient) ListComplete(ctx context.Context, id VideoAnalyzerId, options ListOperationOptions) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, options, EdgeModuleEntityOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c EdgeModulesClient) ListCompleteMatchingPredicate(ctx context.Context, id VideoAnalyzerId, options ListOperationOptions, predicate EdgeModuleEntityOperationPredicate) (result ListCompleteResult, err error) { - items := make([]EdgeModuleEntity, 0) - - resp, err := c.List(ctx, id, options) - if err != nil { - result.LatestHttpResponse = resp.HttpResponse - err = fmt.Errorf("loading results: %+v", err) - return - } - if resp.Model != nil { - for _, v := range *resp.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - result = ListCompleteResult{ - LatestHttpResponse: resp.HttpResponse, - Items: items, - } - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_listprovisioningtoken.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_listprovisioningtoken.go deleted file mode 100644 index d600dbefc86..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/method_listprovisioningtoken.go +++ /dev/null @@ -1,58 +0,0 @@ -package edgemodules - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListProvisioningTokenOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *EdgeModuleProvisioningToken -} - -// ListProvisioningToken ... -func (c EdgeModulesClient) ListProvisioningToken(ctx context.Context, id EdgeModuleId, input ListProvisioningTokenInput) (result ListProvisioningTokenOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/listProvisioningToken", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model EdgeModuleProvisioningToken - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleentity.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleentity.go deleted file mode 100644 index d1a3fa65bcb..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleentity.go +++ /dev/null @@ -1,16 +0,0 @@ -package edgemodules - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EdgeModuleEntity struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *EdgeModuleProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleprovisioningtoken.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleprovisioningtoken.go deleted file mode 100644 index 86022d2bf16..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_edgemoduleprovisioningtoken.go +++ /dev/null @@ -1,27 +0,0 @@ -package edgemodules - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EdgeModuleProvisioningToken struct { - ExpirationDate *string `json:"expirationDate,omitempty"` - Token *string `json:"token,omitempty"` -} - -func (o *EdgeModuleProvisioningToken) GetExpirationDateAsTime() (*time.Time, error) { - if o.ExpirationDate == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") -} - -func (o *EdgeModuleProvisioningToken) SetExpirationDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpirationDate = &formatted -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_listprovisioningtokeninput.go b/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_listprovisioningtokeninput.go deleted file mode 100644 index ae06f6b8fde..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/edgemodules/model_listprovisioningtokeninput.go +++ /dev/null @@ -1,23 +0,0 @@ -package edgemodules - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListProvisioningTokenInput struct { - ExpirationDate string `json:"expirationDate"` -} - -func (o *ListProvisioningTokenInput) GetExpirationDateAsTime() (*time.Time, error) { - return dates.ParseAsFormat(&o.ExpirationDate, "2006-01-02T15:04:05Z07:00") -} - -func (o *ListProvisioningTokenInput) SetExpirationDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpirationDate = formatted -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md deleted file mode 100644 index 703b78b2fa1..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/README.md +++ /dev/null @@ -1,169 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers` Documentation - -The `videoanalyzers` SDK allows for interaction with Azure Resource Manager `videoanalyzer` (API Version `2021-05-01-preview`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -import "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers" -``` - - -### Client Initialization - -```go -client := videoanalyzers.NewVideoAnalyzersClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VideoAnalyzersClient.LocationsCheckNameAvailability` - -```go -ctx := context.TODO() -id := videoanalyzers.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") - -payload := videoanalyzers.CheckNameAvailabilityRequest{ - // ... -} - - -read, err := client.LocationsCheckNameAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideoAnalyzersClient.VideoAnalyzersCreateOrUpdate` - -```go -ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -payload := videoanalyzers.VideoAnalyzer{ - // ... -} - - -read, err := client.VideoAnalyzersCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideoAnalyzersClient.VideoAnalyzersDelete` - -```go -ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -read, err := client.VideoAnalyzersDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideoAnalyzersClient.VideoAnalyzersGet` - -```go -ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -read, err := client.VideoAnalyzersGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideoAnalyzersClient.VideoAnalyzersList` - -```go -ctx := context.TODO() -id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -read, err := client.VideoAnalyzersList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideoAnalyzersClient.VideoAnalyzersListBySubscription` - -```go -ctx := context.TODO() -id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -read, err := client.VideoAnalyzersListBySubscription(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideoAnalyzersClient.VideoAnalyzersSyncStorageKeys` - -```go -ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -payload := videoanalyzers.SyncStorageKeysInput{ - // ... -} - - -read, err := client.VideoAnalyzersSyncStorageKeys(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideoAnalyzersClient.VideoAnalyzersUpdate` - -```go -ctx := context.TODO() -id := videoanalyzers.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -payload := videoanalyzers.VideoAnalyzerUpdate{ - // ... -} - - -read, err := client.VideoAnalyzersUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/constants.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/constants.go deleted file mode 100644 index a3434279c58..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/constants.go +++ /dev/null @@ -1,130 +0,0 @@ -package videoanalyzers - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryptionKeyType string - -const ( - AccountEncryptionKeyTypeCustomerKey AccountEncryptionKeyType = "CustomerKey" - AccountEncryptionKeyTypeSystemKey AccountEncryptionKeyType = "SystemKey" -) - -func PossibleValuesForAccountEncryptionKeyType() []string { - return []string{ - string(AccountEncryptionKeyTypeCustomerKey), - string(AccountEncryptionKeyTypeSystemKey), - } -} - -func (s *AccountEncryptionKeyType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAccountEncryptionKeyType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAccountEncryptionKeyType(input string) (*AccountEncryptionKeyType, error) { - vals := map[string]AccountEncryptionKeyType{ - "customerkey": AccountEncryptionKeyTypeCustomerKey, - "systemkey": AccountEncryptionKeyTypeSystemKey, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccountEncryptionKeyType(input) - return &out, nil -} - -type CheckNameAvailabilityReason string - -const ( - CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" - CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" -) - -func PossibleValuesForCheckNameAvailabilityReason() []string { - return []string{ - string(CheckNameAvailabilityReasonAlreadyExists), - string(CheckNameAvailabilityReasonInvalid), - } -} - -func (s *CheckNameAvailabilityReason) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckNameAvailabilityReason(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckNameAvailabilityReason(input string) (*CheckNameAvailabilityReason, error) { - vals := map[string]CheckNameAvailabilityReason{ - "alreadyexists": CheckNameAvailabilityReasonAlreadyExists, - "invalid": CheckNameAvailabilityReasonInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckNameAvailabilityReason(input) - return &out, nil -} - -type VideoAnalyzerEndpointType string - -const ( - VideoAnalyzerEndpointTypeClientApi VideoAnalyzerEndpointType = "ClientApi" -) - -func PossibleValuesForVideoAnalyzerEndpointType() []string { - return []string{ - string(VideoAnalyzerEndpointTypeClientApi), - } -} - -func (s *VideoAnalyzerEndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVideoAnalyzerEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVideoAnalyzerEndpointType(input string) (*VideoAnalyzerEndpointType, error) { - vals := map[string]VideoAnalyzerEndpointType{ - "clientapi": VideoAnalyzerEndpointTypeClientApi, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VideoAnalyzerEndpointType(input) - return &out, nil -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go deleted file mode 100644 index 692bcd8fbc7..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location.go +++ /dev/null @@ -1,121 +0,0 @@ -package videoanalyzers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&LocationId{}) -} - -var _ resourceids.ResourceId = &LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - LocationName string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, locationName string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(&LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(&LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - return nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.Media/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationName"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location_test.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location_test.go deleted file mode 100644 index 1014e9d7b75..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_location_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package videoanalyzers - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &LocationId{} - -func TestNewLocationID(t *testing.T) { - id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationName" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") - } -} - -func TestFormatLocationID(t *testing.T) { - actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media/locations/locationName" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseLocationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media/locations", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media/locations/locationName", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media/locations/locationName/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestParseLocationIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.mEdIa", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.mEdIa/lOcAtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media/locations/locationName", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationName", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Media/locations/locationName/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.mEdIa/lOcAtIoNs/lOcAtIoNnAmE", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNnAmE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.mEdIa/lOcAtIoNs/lOcAtIoNnAmE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestSegmentsForLocationId(t *testing.T) { - segments := LocationId{}.Segments() - if len(segments) == 0 { - t.Fatalf("LocationId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go deleted file mode 100644 index 0b24231e0e4..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/id_videoanalyzer.go +++ /dev/null @@ -1,130 +0,0 @@ -package videoanalyzers - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VideoAnalyzerId{}) -} - -var _ resourceids.ResourceId = &VideoAnalyzerId{} - -// VideoAnalyzerId is a struct representing the Resource ID for a Video Analyzer -type VideoAnalyzerId struct { - SubscriptionId string - ResourceGroupName string - VideoAnalyzerName string -} - -// NewVideoAnalyzerID returns a new VideoAnalyzerId struct -func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, videoAnalyzerName string) VideoAnalyzerId { - return VideoAnalyzerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VideoAnalyzerName: videoAnalyzerName, - } -} - -// ParseVideoAnalyzerID parses 'input' into a VideoAnalyzerId -func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoAnalyzerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoAnalyzerId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVideoAnalyzerIDInsensitively parses 'input' case-insensitively into a VideoAnalyzerId -// note: this method should only be used for API response data and not user input -func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoAnalyzerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoAnalyzerId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VideoAnalyzerId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) - } - - return nil -} - -// ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID -func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVideoAnalyzerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Video Analyzer ID -func (id VideoAnalyzerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID -func (id VideoAnalyzerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerName"), - } -} - -// String returns a human-readable description of this Video Analyzer ID -func (id VideoAnalyzerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), - } - return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_locationschecknameavailability.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_locationschecknameavailability.go deleted file mode 100644 index 478ec54c9b0..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_locationschecknameavailability.go +++ /dev/null @@ -1,58 +0,0 @@ -package videoanalyzers - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LocationsCheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckNameAvailabilityResponse -} - -// LocationsCheckNameAvailability ... -func (c VideoAnalyzersClient) LocationsCheckNameAvailability(ctx context.Context, id LocationId, input CheckNameAvailabilityRequest) (result LocationsCheckNameAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkNameAvailability", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model CheckNameAvailabilityResponse - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerscreateorupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerscreateorupdate.go deleted file mode 100644 index cf9c732a8d9..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerscreateorupdate.go +++ /dev/null @@ -1,58 +0,0 @@ -package videoanalyzers - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzersCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VideoAnalyzer -} - -// VideoAnalyzersCreateOrUpdate ... -func (c VideoAnalyzersClient) VideoAnalyzersCreateOrUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzer) (result VideoAnalyzersCreateOrUpdateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusCreated, - http.StatusOK, - }, - HttpMethod: http.MethodPut, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model VideoAnalyzer - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersdelete.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersdelete.go deleted file mode 100644 index 73a9e51b949..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersdelete.go +++ /dev/null @@ -1,47 +0,0 @@ -package videoanalyzers - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzersDeleteOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData -} - -// VideoAnalyzersDelete ... -func (c VideoAnalyzersClient) VideoAnalyzersDelete(ctx context.Context, id VideoAnalyzerId) (result VideoAnalyzersDeleteOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusNoContent, - http.StatusOK, - }, - HttpMethod: http.MethodDelete, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslist.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslist.go deleted file mode 100644 index c6dd7920459..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslist.go +++ /dev/null @@ -1,55 +0,0 @@ -package videoanalyzers - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzersListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VideoAnalyzerCollection -} - -// VideoAnalyzersList ... -func (c VideoAnalyzersClient) VideoAnalyzersList(ctx context.Context, id commonids.ResourceGroupId) (result VideoAnalyzersListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.Media/videoAnalyzers", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model VideoAnalyzerCollection - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslistbysubscription.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslistbysubscription.go deleted file mode 100644 index a7476c4df19..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerslistbysubscription.go +++ /dev/null @@ -1,55 +0,0 @@ -package videoanalyzers - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzersListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VideoAnalyzerCollection -} - -// VideoAnalyzersListBySubscription ... -func (c VideoAnalyzersClient) VideoAnalyzersListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result VideoAnalyzersListBySubscriptionOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.Media/videoAnalyzers", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model VideoAnalyzerCollection - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerssyncstoragekeys.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerssyncstoragekeys.go deleted file mode 100644 index 829fd5728e7..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzerssyncstoragekeys.go +++ /dev/null @@ -1,51 +0,0 @@ -package videoanalyzers - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzersSyncStorageKeysOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData -} - -// VideoAnalyzersSyncStorageKeys ... -func (c VideoAnalyzersClient) VideoAnalyzersSyncStorageKeys(ctx context.Context, id VideoAnalyzerId, input SyncStorageKeysInput) (result VideoAnalyzersSyncStorageKeysOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/syncStorageKeys", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersupdate.go deleted file mode 100644 index 6ef729fc106..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/method_videoanalyzersupdate.go +++ /dev/null @@ -1,57 +0,0 @@ -package videoanalyzers - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzersUpdateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VideoAnalyzer -} - -// VideoAnalyzersUpdate ... -func (c VideoAnalyzersClient) VideoAnalyzersUpdate(ctx context.Context, id VideoAnalyzerId, input VideoAnalyzerUpdate) (result VideoAnalyzersUpdateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPatch, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model VideoAnalyzer - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_accountencryption.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_accountencryption.go deleted file mode 100644 index 34f08dfc82f..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_accountencryption.go +++ /dev/null @@ -1,11 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryption struct { - Identity *ResourceIdentity `json:"identity,omitempty"` - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` - Status *string `json:"status,omitempty"` - Type AccountEncryptionKeyType `json:"type"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityresponse.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityresponse.go deleted file mode 100644 index 6bc73d1afbb..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_checknameavailabilityresponse.go +++ /dev/null @@ -1,10 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckNameAvailabilityResponse struct { - Message *string `json:"message,omitempty"` - NameAvailable *bool `json:"nameAvailable,omitempty"` - Reason *CheckNameAvailabilityReason `json:"reason,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_endpoint.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_endpoint.go deleted file mode 100644 index f2e9d1b1f3b..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_endpoint.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Endpoint struct { - EndpointURL *string `json:"endpointUrl,omitempty"` - Type VideoAnalyzerEndpointType `json:"type"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_keyvaultproperties.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_keyvaultproperties.go deleted file mode 100644 index ef30930b304..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_keyvaultproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KeyVaultProperties struct { - CurrentKeyIdentifier *string `json:"currentKeyIdentifier,omitempty"` - KeyIdentifier string `json:"keyIdentifier"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_storageaccount.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_storageaccount.go deleted file mode 100644 index d450687d423..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_storageaccount.go +++ /dev/null @@ -1,10 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type StorageAccount struct { - Id *string `json:"id,omitempty"` - Identity *ResourceIdentity `json:"identity,omitempty"` - Status *string `json:"status,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_userassignedmanagedidentity.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_userassignedmanagedidentity.go deleted file mode 100644 index dc30c306f3c..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_userassignedmanagedidentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type UserAssignedManagedIdentity struct { - ClientId *string `json:"clientId,omitempty"` - PrincipalId *string `json:"principalId,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzer.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzer.go deleted file mode 100644 index 30326d20579..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzer.go +++ /dev/null @@ -1,19 +0,0 @@ -package videoanalyzers - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzer struct { - Id *string `json:"id,omitempty"` - Identity *VideoAnalyzerIdentity `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *VideoAnalyzerPropertiesUpdate `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzeridentity.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzeridentity.go deleted file mode 100644 index ac2da6867b3..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzeridentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzerIdentity struct { - Type string `json:"type"` - UserAssignedIdentities *map[string]UserAssignedManagedIdentity `json:"userAssignedIdentities,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerpropertiesupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerpropertiesupdate.go deleted file mode 100644 index 59fcd01795c..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerpropertiesupdate.go +++ /dev/null @@ -1,10 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzerPropertiesUpdate struct { - Encryption *AccountEncryption `json:"encryption,omitempty"` - Endpoints *[]Endpoint `json:"endpoints,omitempty"` - StorageAccounts *[]StorageAccount `json:"storageAccounts,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerupdate.go deleted file mode 100644 index 47556dbbd88..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videoanalyzers/model_videoanalyzerupdate.go +++ /dev/null @@ -1,10 +0,0 @@ -package videoanalyzers - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoAnalyzerUpdate struct { - Identity *VideoAnalyzerIdentity `json:"identity,omitempty"` - Properties *VideoAnalyzerPropertiesUpdate `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/README.md b/resource-manager/videoanalyzer/2021-05-01-preview/videos/README.md deleted file mode 100644 index 8b375e52482..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/README.md +++ /dev/null @@ -1,218 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videos` Documentation - -The `videos` SDK allows for interaction with Azure Resource Manager `videoanalyzer` (API Version `2021-05-01-preview`). - -This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). - -### Import Path - -```go -import "github.com/hashicorp/go-azure-sdk/resource-manager/videoanalyzer/2021-05-01-preview/videos" -``` - - -### Client Initialization - -```go -client := videos.NewVideosClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VideosClient.AccessPoliciesCreateOrUpdate` - -```go -ctx := context.TODO() -id := videos.NewAccessPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "accessPolicyName") - -payload := videos.AccessPolicyEntity{ - // ... -} - - -read, err := client.AccessPoliciesCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.AccessPoliciesDelete` - -```go -ctx := context.TODO() -id := videos.NewAccessPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "accessPolicyName") - -read, err := client.AccessPoliciesDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.AccessPoliciesGet` - -```go -ctx := context.TODO() -id := videos.NewAccessPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "accessPolicyName") - -read, err := client.AccessPoliciesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.AccessPoliciesList` - -```go -ctx := context.TODO() -id := videos.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -// alternatively `client.AccessPoliciesList(ctx, id, videos.DefaultAccessPoliciesListOperationOptions())` can be used to do batched pagination -items, err := client.AccessPoliciesListComplete(ctx, id, videos.DefaultAccessPoliciesListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `VideosClient.AccessPoliciesUpdate` - -```go -ctx := context.TODO() -id := videos.NewAccessPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "accessPolicyName") - -payload := videos.AccessPolicyEntity{ - // ... -} - - -read, err := client.AccessPoliciesUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.VideosCreateOrUpdate` - -```go -ctx := context.TODO() -id := videos.NewVideoID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "videoName") - -payload := videos.VideoEntity{ - // ... -} - - -read, err := client.VideosCreateOrUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.VideosDelete` - -```go -ctx := context.TODO() -id := videos.NewVideoID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "videoName") - -read, err := client.VideosDelete(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.VideosGet` - -```go -ctx := context.TODO() -id := videos.NewVideoID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "videoName") - -read, err := client.VideosGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.VideosList` - -```go -ctx := context.TODO() -id := videos.NewVideoAnalyzerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName") - -// alternatively `client.VideosList(ctx, id, videos.DefaultVideosListOperationOptions())` can be used to do batched pagination -items, err := client.VideosListComplete(ctx, id, videos.DefaultVideosListOperationOptions()) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `VideosClient.VideosListStreamingToken` - -```go -ctx := context.TODO() -id := videos.NewVideoID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "videoName") - -read, err := client.VideosListStreamingToken(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VideosClient.VideosUpdate` - -```go -ctx := context.TODO() -id := videos.NewVideoID("12345678-1234-9876-4563-123456789012", "example-resource-group", "videoAnalyzerName", "videoName") - -payload := videos.VideoEntity{ - // ... -} - - -read, err := client.VideosUpdate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/constants.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/constants.go deleted file mode 100644 index 456db108736..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/constants.go +++ /dev/null @@ -1,174 +0,0 @@ -package videos - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccessPolicyEccAlgo string - -const ( - AccessPolicyEccAlgoESFiveOneTwo AccessPolicyEccAlgo = "ES512" - AccessPolicyEccAlgoESThreeEightFour AccessPolicyEccAlgo = "ES384" - AccessPolicyEccAlgoESTwoFiveSix AccessPolicyEccAlgo = "ES256" -) - -func PossibleValuesForAccessPolicyEccAlgo() []string { - return []string{ - string(AccessPolicyEccAlgoESFiveOneTwo), - string(AccessPolicyEccAlgoESThreeEightFour), - string(AccessPolicyEccAlgoESTwoFiveSix), - } -} - -func (s *AccessPolicyEccAlgo) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAccessPolicyEccAlgo(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAccessPolicyEccAlgo(input string) (*AccessPolicyEccAlgo, error) { - vals := map[string]AccessPolicyEccAlgo{ - "es512": AccessPolicyEccAlgoESFiveOneTwo, - "es384": AccessPolicyEccAlgoESThreeEightFour, - "es256": AccessPolicyEccAlgoESTwoFiveSix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessPolicyEccAlgo(input) - return &out, nil -} - -type AccessPolicyRole string - -const ( - AccessPolicyRoleReader AccessPolicyRole = "Reader" -) - -func PossibleValuesForAccessPolicyRole() []string { - return []string{ - string(AccessPolicyRoleReader), - } -} - -func (s *AccessPolicyRole) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAccessPolicyRole(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAccessPolicyRole(input string) (*AccessPolicyRole, error) { - vals := map[string]AccessPolicyRole{ - "reader": AccessPolicyRoleReader, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessPolicyRole(input) - return &out, nil -} - -type AccessPolicyRsaAlgo string - -const ( - AccessPolicyRsaAlgoRSFiveOneTwo AccessPolicyRsaAlgo = "RS512" - AccessPolicyRsaAlgoRSThreeEightFour AccessPolicyRsaAlgo = "RS384" - AccessPolicyRsaAlgoRSTwoFiveSix AccessPolicyRsaAlgo = "RS256" -) - -func PossibleValuesForAccessPolicyRsaAlgo() []string { - return []string{ - string(AccessPolicyRsaAlgoRSFiveOneTwo), - string(AccessPolicyRsaAlgoRSThreeEightFour), - string(AccessPolicyRsaAlgoRSTwoFiveSix), - } -} - -func (s *AccessPolicyRsaAlgo) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAccessPolicyRsaAlgo(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAccessPolicyRsaAlgo(input string) (*AccessPolicyRsaAlgo, error) { - vals := map[string]AccessPolicyRsaAlgo{ - "rs512": AccessPolicyRsaAlgoRSFiveOneTwo, - "rs384": AccessPolicyRsaAlgoRSThreeEightFour, - "rs256": AccessPolicyRsaAlgoRSTwoFiveSix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AccessPolicyRsaAlgo(input) - return &out, nil -} - -type VideoType string - -const ( - VideoTypeArchive VideoType = "Archive" -) - -func PossibleValuesForVideoType() []string { - return []string{ - string(VideoTypeArchive), - } -} - -func (s *VideoType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVideoType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVideoType(input string) (*VideoType, error) { - vals := map[string]VideoType{ - "archive": VideoTypeArchive, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VideoType(input) - return &out, nil -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy.go deleted file mode 100644 index ff978d4010d..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_accesspolicy.go +++ /dev/null @@ -1,139 +0,0 @@ -package videos - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&AccessPolicyId{}) -} - -var _ resourceids.ResourceId = &AccessPolicyId{} - -// AccessPolicyId is a struct representing the Resource ID for a Access Policy -type AccessPolicyId struct { - SubscriptionId string - ResourceGroupName string - VideoAnalyzerName string - AccessPolicyName string -} - -// NewAccessPolicyID returns a new AccessPolicyId struct -func NewAccessPolicyID(subscriptionId string, resourceGroupName string, videoAnalyzerName string, accessPolicyName string) AccessPolicyId { - return AccessPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VideoAnalyzerName: videoAnalyzerName, - AccessPolicyName: accessPolicyName, - } -} - -// ParseAccessPolicyID parses 'input' into a AccessPolicyId -func ParseAccessPolicyID(input string) (*AccessPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(&AccessPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccessPolicyId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseAccessPolicyIDInsensitively parses 'input' case-insensitively into a AccessPolicyId -// note: this method should only be used for API response data and not user input -func ParseAccessPolicyIDInsensitively(input string) (*AccessPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(&AccessPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccessPolicyId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *AccessPolicyId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) - } - - if id.AccessPolicyName, ok = input.Parsed["accessPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "accessPolicyName", input) - } - - return nil -} - -// ValidateAccessPolicyID checks that 'input' can be parsed as a Access Policy ID -func ValidateAccessPolicyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseAccessPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Access Policy ID -func (id AccessPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s/accessPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName, id.AccessPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Access Policy ID -func (id AccessPolicyId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerName"), - resourceids.StaticSegment("staticAccessPolicies", "accessPolicies", "accessPolicies"), - resourceids.UserSpecifiedSegment("accessPolicyName", "accessPolicyName"), - } -} - -// String returns a human-readable description of this Access Policy ID -func (id AccessPolicyId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), - fmt.Sprintf("Access Policy Name: %q", id.AccessPolicyName), - } - return fmt.Sprintf("Access Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video.go deleted file mode 100644 index aa583295318..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_video.go +++ /dev/null @@ -1,139 +0,0 @@ -package videos - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VideoId{}) -} - -var _ resourceids.ResourceId = &VideoId{} - -// VideoId is a struct representing the Resource ID for a Video -type VideoId struct { - SubscriptionId string - ResourceGroupName string - VideoAnalyzerName string - VideoName string -} - -// NewVideoID returns a new VideoId struct -func NewVideoID(subscriptionId string, resourceGroupName string, videoAnalyzerName string, videoName string) VideoId { - return VideoId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VideoAnalyzerName: videoAnalyzerName, - VideoName: videoName, - } -} - -// ParseVideoID parses 'input' into a VideoId -func ParseVideoID(input string) (*VideoId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVideoIDInsensitively parses 'input' case-insensitively into a VideoId -// note: this method should only be used for API response data and not user input -func ParseVideoIDInsensitively(input string) (*VideoId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VideoId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) - } - - if id.VideoName, ok = input.Parsed["videoName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "videoName", input) - } - - return nil -} - -// ValidateVideoID checks that 'input' can be parsed as a Video ID -func ValidateVideoID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVideoID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Video ID -func (id VideoId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s/videos/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName, id.VideoName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Video ID -func (id VideoId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerName"), - resourceids.StaticSegment("staticVideos", "videos", "videos"), - resourceids.UserSpecifiedSegment("videoName", "videoName"), - } -} - -// String returns a human-readable description of this Video ID -func (id VideoId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), - fmt.Sprintf("Video Name: %q", id.VideoName), - } - return fmt.Sprintf("Video (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer.go deleted file mode 100644 index 1ac9e79cd22..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/id_videoanalyzer.go +++ /dev/null @@ -1,130 +0,0 @@ -package videos - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -func init() { - recaser.RegisterResourceId(&VideoAnalyzerId{}) -} - -var _ resourceids.ResourceId = &VideoAnalyzerId{} - -// VideoAnalyzerId is a struct representing the Resource ID for a Video Analyzer -type VideoAnalyzerId struct { - SubscriptionId string - ResourceGroupName string - VideoAnalyzerName string -} - -// NewVideoAnalyzerID returns a new VideoAnalyzerId struct -func NewVideoAnalyzerID(subscriptionId string, resourceGroupName string, videoAnalyzerName string) VideoAnalyzerId { - return VideoAnalyzerId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - VideoAnalyzerName: videoAnalyzerName, - } -} - -// ParseVideoAnalyzerID parses 'input' into a VideoAnalyzerId -func ParseVideoAnalyzerID(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoAnalyzerId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoAnalyzerId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVideoAnalyzerIDInsensitively parses 'input' case-insensitively into a VideoAnalyzerId -// note: this method should only be used for API response data and not user input -func ParseVideoAnalyzerIDInsensitively(input string) (*VideoAnalyzerId, error) { - parser := resourceids.NewParserFromResourceIdType(&VideoAnalyzerId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VideoAnalyzerId{} - if err = id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VideoAnalyzerId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) - } - - if id.VideoAnalyzerName, ok = input.Parsed["videoAnalyzerName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "videoAnalyzerName", input) - } - - return nil -} - -// ValidateVideoAnalyzerID checks that 'input' can be parsed as a Video Analyzer ID -func ValidateVideoAnalyzerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseVideoAnalyzerID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Video Analyzer ID -func (id VideoAnalyzerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Media/videoAnalyzers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VideoAnalyzerName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Video Analyzer ID -func (id VideoAnalyzerId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftMedia", "Microsoft.Media", "Microsoft.Media"), - resourceids.StaticSegment("staticVideoAnalyzers", "videoAnalyzers", "videoAnalyzers"), - resourceids.UserSpecifiedSegment("videoAnalyzerName", "videoAnalyzerName"), - } -} - -// String returns a human-readable description of this Video Analyzer ID -func (id VideoAnalyzerId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Video Analyzer Name: %q", id.VideoAnalyzerName), - } - return fmt.Sprintf("Video Analyzer (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciescreateorupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciescreateorupdate.go deleted file mode 100644 index 4274d1f0813..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciescreateorupdate.go +++ /dev/null @@ -1,58 +0,0 @@ -package videos - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccessPoliciesCreateOrUpdateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *AccessPolicyEntity -} - -// AccessPoliciesCreateOrUpdate ... -func (c VideosClient) AccessPoliciesCreateOrUpdate(ctx context.Context, id AccessPolicyId, input AccessPolicyEntity) (result AccessPoliciesCreateOrUpdateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusCreated, - http.StatusOK, - }, - HttpMethod: http.MethodPut, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model AccessPolicyEntity - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesdelete.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesdelete.go deleted file mode 100644 index cab699dc89b..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesdelete.go +++ /dev/null @@ -1,47 +0,0 @@ -package videos - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccessPoliciesDeleteOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData -} - -// AccessPoliciesDelete ... -func (c VideosClient) AccessPoliciesDelete(ctx context.Context, id AccessPolicyId) (result AccessPoliciesDeleteOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusNoContent, - http.StatusOK, - }, - HttpMethod: http.MethodDelete, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspolicieslist.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspolicieslist.go deleted file mode 100644 index 234f363a10c..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspolicieslist.go +++ /dev/null @@ -1,134 +0,0 @@ -package videos - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccessPoliciesListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]AccessPolicyEntity -} - -type AccessPoliciesListCompleteResult struct { - LatestHttpResponse *http.Response - Items []AccessPolicyEntity -} - -type AccessPoliciesListOperationOptions struct { - Top *int64 -} - -func DefaultAccessPoliciesListOperationOptions() AccessPoliciesListOperationOptions { - return AccessPoliciesListOperationOptions{} -} - -func (o AccessPoliciesListOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o AccessPoliciesListOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - - return &out -} - -func (o AccessPoliciesListOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.Top != nil { - out.Append("$top", fmt.Sprintf("%v", *o.Top)) - } - return &out -} - -type AccessPoliciesListCustomPager struct { - NextLink *odata.Link `json:"@nextLink"` -} - -func (p *AccessPoliciesListCustomPager) NextPageLink() *odata.Link { - defer func() { - p.NextLink = nil - }() - - return p.NextLink -} - -// AccessPoliciesList ... -func (c VideosClient) AccessPoliciesList(ctx context.Context, id VideoAnalyzerId, options AccessPoliciesListOperationOptions) (result AccessPoliciesListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - OptionsObject: options, - Pager: &AccessPoliciesListCustomPager{}, - Path: fmt.Sprintf("%s/accessPolicies", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.ExecutePaged(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var values struct { - Values *[]AccessPolicyEntity `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccessPoliciesListComplete retrieves all the results into a single object -func (c VideosClient) AccessPoliciesListComplete(ctx context.Context, id VideoAnalyzerId, options AccessPoliciesListOperationOptions) (AccessPoliciesListCompleteResult, error) { - return c.AccessPoliciesListCompleteMatchingPredicate(ctx, id, options, AccessPolicyEntityOperationPredicate{}) -} - -// AccessPoliciesListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c VideosClient) AccessPoliciesListCompleteMatchingPredicate(ctx context.Context, id VideoAnalyzerId, options AccessPoliciesListOperationOptions, predicate AccessPolicyEntityOperationPredicate) (result AccessPoliciesListCompleteResult, err error) { - items := make([]AccessPolicyEntity, 0) - - resp, err := c.AccessPoliciesList(ctx, id, options) - if err != nil { - result.LatestHttpResponse = resp.HttpResponse - err = fmt.Errorf("loading results: %+v", err) - return - } - if resp.Model != nil { - for _, v := range *resp.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - result = AccessPoliciesListCompleteResult{ - LatestHttpResponse: resp.HttpResponse, - Items: items, - } - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesupdate.go deleted file mode 100644 index 1209238aed5..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_accesspoliciesupdate.go +++ /dev/null @@ -1,57 +0,0 @@ -package videos - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccessPoliciesUpdateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *AccessPolicyEntity -} - -// AccessPoliciesUpdate ... -func (c VideosClient) AccessPoliciesUpdate(ctx context.Context, id AccessPolicyId, input AccessPolicyEntity) (result AccessPoliciesUpdateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPatch, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model AccessPolicyEntity - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosdelete.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosdelete.go deleted file mode 100644 index 6843278c223..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosdelete.go +++ /dev/null @@ -1,47 +0,0 @@ -package videos - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideosDeleteOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData -} - -// VideosDelete ... -func (c VideosClient) VideosDelete(ctx context.Context, id VideoId) (result VideosDeleteOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusNoContent, - http.StatusOK, - }, - HttpMethod: http.MethodDelete, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videoslist.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videoslist.go deleted file mode 100644 index 2b1d291dfac..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videoslist.go +++ /dev/null @@ -1,134 +0,0 @@ -package videos - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideosListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]VideoEntity -} - -type VideosListCompleteResult struct { - LatestHttpResponse *http.Response - Items []VideoEntity -} - -type VideosListOperationOptions struct { - Top *int64 -} - -func DefaultVideosListOperationOptions() VideosListOperationOptions { - return VideosListOperationOptions{} -} - -func (o VideosListOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o VideosListOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - - return &out -} - -func (o VideosListOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.Top != nil { - out.Append("$top", fmt.Sprintf("%v", *o.Top)) - } - return &out -} - -type VideosListCustomPager struct { - NextLink *odata.Link `json:"@nextLink"` -} - -func (p *VideosListCustomPager) NextPageLink() *odata.Link { - defer func() { - p.NextLink = nil - }() - - return p.NextLink -} - -// VideosList ... -func (c VideosClient) VideosList(ctx context.Context, id VideoAnalyzerId, options VideosListOperationOptions) (result VideosListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - OptionsObject: options, - Pager: &VideosListCustomPager{}, - Path: fmt.Sprintf("%s/videos", id.ID()), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - var resp *client.Response - resp, err = req.ExecutePaged(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var values struct { - Values *[]VideoEntity `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// VideosListComplete retrieves all the results into a single object -func (c VideosClient) VideosListComplete(ctx context.Context, id VideoAnalyzerId, options VideosListOperationOptions) (VideosListCompleteResult, error) { - return c.VideosListCompleteMatchingPredicate(ctx, id, options, VideoEntityOperationPredicate{}) -} - -// VideosListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c VideosClient) VideosListCompleteMatchingPredicate(ctx context.Context, id VideoAnalyzerId, options VideosListOperationOptions, predicate VideoEntityOperationPredicate) (result VideosListCompleteResult, err error) { - items := make([]VideoEntity, 0) - - resp, err := c.VideosList(ctx, id, options) - if err != nil { - result.LatestHttpResponse = resp.HttpResponse - err = fmt.Errorf("loading results: %+v", err) - return - } - if resp.Model != nil { - for _, v := range *resp.Model { - if predicate.Matches(v) { - items = append(items, v) - } - } - } - - result = VideosListCompleteResult{ - LatestHttpResponse: resp.HttpResponse, - Items: items, - } - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosupdate.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosupdate.go deleted file mode 100644 index 735a1366878..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/method_videosupdate.go +++ /dev/null @@ -1,57 +0,0 @@ -package videos - -import ( - "context" - "net/http" - - "github.com/hashicorp/go-azure-sdk/sdk/client" - "github.com/hashicorp/go-azure-sdk/sdk/odata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideosUpdateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VideoEntity -} - -// VideosUpdate ... -func (c VideosClient) VideosUpdate(ctx context.Context, id VideoId, input VideoEntity) (result VideosUpdateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPatch, - Path: id.ID(), - } - - req, err := c.Client.NewRequest(ctx, opts) - if err != nil { - return - } - - if err = req.Marshal(input); err != nil { - return - } - - var resp *client.Response - resp, err = req.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - var model VideoEntity - result.Model = &model - if err = resp.Unmarshal(result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_accesspolicyentity.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_accesspolicyentity.go deleted file mode 100644 index 7a10407732e..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_accesspolicyentity.go +++ /dev/null @@ -1,16 +0,0 @@ -package videos - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccessPolicyEntity struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AccessPolicyProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_accesspolicyproperties.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_accesspolicyproperties.go deleted file mode 100644 index 8c8abedc937..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_accesspolicyproperties.go +++ /dev/null @@ -1,42 +0,0 @@ -package videos - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccessPolicyProperties struct { - Authentication AuthenticationBase `json:"authentication"` - Role *AccessPolicyRole `json:"role,omitempty"` -} - -var _ json.Unmarshaler = &AccessPolicyProperties{} - -func (s *AccessPolicyProperties) UnmarshalJSON(bytes []byte) error { - var decoded struct { - Role *AccessPolicyRole `json:"role,omitempty"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.Role = decoded.Role - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling AccessPolicyProperties into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["authentication"]; ok { - impl, err := UnmarshalAuthenticationBaseImplementation(v) - if err != nil { - return fmt.Errorf("unmarshaling field 'Authentication' for 'AccessPolicyProperties': %+v", err) - } - s.Authentication = impl - } - - return nil -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_authenticationbase.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_authenticationbase.go deleted file mode 100644 index 305e846a2f7..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_authenticationbase.go +++ /dev/null @@ -1,75 +0,0 @@ -package videos - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthenticationBase interface { - AuthenticationBase() BaseAuthenticationBaseImpl -} - -var _ AuthenticationBase = BaseAuthenticationBaseImpl{} - -type BaseAuthenticationBaseImpl struct { - Type string `json:"@type"` -} - -func (s BaseAuthenticationBaseImpl) AuthenticationBase() BaseAuthenticationBaseImpl { - return s -} - -var _ AuthenticationBase = RawAuthenticationBaseImpl{} - -// RawAuthenticationBaseImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawAuthenticationBaseImpl struct { - authenticationBase BaseAuthenticationBaseImpl - Type string - Values map[string]interface{} -} - -func (s RawAuthenticationBaseImpl) AuthenticationBase() BaseAuthenticationBaseImpl { - return s.authenticationBase -} - -func UnmarshalAuthenticationBaseImplementation(input []byte) (AuthenticationBase, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling AuthenticationBase into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["@type"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "#Microsoft.VideoAnalyzer.JwtAuthentication") { - var out JwtAuthentication - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into JwtAuthentication: %+v", err) - } - return out, nil - } - - var parent BaseAuthenticationBaseImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseAuthenticationBaseImpl: %+v", err) - } - - return RawAuthenticationBaseImpl{ - authenticationBase: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_ecctokenkey.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_ecctokenkey.go deleted file mode 100644 index 712a72b3cdf..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_ecctokenkey.go +++ /dev/null @@ -1,54 +0,0 @@ -package videos - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TokenKey = EccTokenKey{} - -type EccTokenKey struct { - Alg AccessPolicyEccAlgo `json:"alg"` - X string `json:"x"` - Y string `json:"y"` - - // Fields inherited from TokenKey - - Kid string `json:"kid"` - Type string `json:"@type"` -} - -func (s EccTokenKey) TokenKey() BaseTokenKeyImpl { - return BaseTokenKeyImpl{ - Kid: s.Kid, - Type: s.Type, - } -} - -var _ json.Marshaler = EccTokenKey{} - -func (s EccTokenKey) MarshalJSON() ([]byte, error) { - type wrapper EccTokenKey - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling EccTokenKey: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling EccTokenKey: %+v", err) - } - - decoded["@type"] = "#Microsoft.VideoAnalyzer.EccTokenKey" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling EccTokenKey: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_jwtauthentication.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_jwtauthentication.go deleted file mode 100644 index 51c21dd5207..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_jwtauthentication.go +++ /dev/null @@ -1,96 +0,0 @@ -package videos - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ AuthenticationBase = JwtAuthentication{} - -type JwtAuthentication struct { - Audiences *[]string `json:"audiences,omitempty"` - Claims *[]TokenClaim `json:"claims,omitempty"` - Issuers *[]string `json:"issuers,omitempty"` - Keys *[]TokenKey `json:"keys,omitempty"` - - // Fields inherited from AuthenticationBase - - Type string `json:"@type"` -} - -func (s JwtAuthentication) AuthenticationBase() BaseAuthenticationBaseImpl { - return BaseAuthenticationBaseImpl{ - Type: s.Type, - } -} - -var _ json.Marshaler = JwtAuthentication{} - -func (s JwtAuthentication) MarshalJSON() ([]byte, error) { - type wrapper JwtAuthentication - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling JwtAuthentication: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling JwtAuthentication: %+v", err) - } - - decoded["@type"] = "#Microsoft.VideoAnalyzer.JwtAuthentication" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling JwtAuthentication: %+v", err) - } - - return encoded, nil -} - -var _ json.Unmarshaler = &JwtAuthentication{} - -func (s *JwtAuthentication) UnmarshalJSON(bytes []byte) error { - var decoded struct { - Audiences *[]string `json:"audiences,omitempty"` - Claims *[]TokenClaim `json:"claims,omitempty"` - Issuers *[]string `json:"issuers,omitempty"` - Type string `json:"@type"` - } - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - - s.Audiences = decoded.Audiences - s.Claims = decoded.Claims - s.Issuers = decoded.Issuers - s.Type = decoded.Type - - var temp map[string]json.RawMessage - if err := json.Unmarshal(bytes, &temp); err != nil { - return fmt.Errorf("unmarshaling JwtAuthentication into map[string]json.RawMessage: %+v", err) - } - - if v, ok := temp["keys"]; ok { - var listTemp []json.RawMessage - if err := json.Unmarshal(v, &listTemp); err != nil { - return fmt.Errorf("unmarshaling Keys into list []json.RawMessage: %+v", err) - } - - output := make([]TokenKey, 0) - for i, val := range listTemp { - impl, err := UnmarshalTokenKeyImplementation(val) - if err != nil { - return fmt.Errorf("unmarshaling index %d field 'Keys' for 'JwtAuthentication': %+v", i, err) - } - output = append(output, impl) - } - s.Keys = &output - } - - return nil -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_rsatokenkey.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_rsatokenkey.go deleted file mode 100644 index c73025d9bc1..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_rsatokenkey.go +++ /dev/null @@ -1,54 +0,0 @@ -package videos - -import ( - "encoding/json" - "fmt" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ TokenKey = RsaTokenKey{} - -type RsaTokenKey struct { - Alg AccessPolicyRsaAlgo `json:"alg"` - E string `json:"e"` - N string `json:"n"` - - // Fields inherited from TokenKey - - Kid string `json:"kid"` - Type string `json:"@type"` -} - -func (s RsaTokenKey) TokenKey() BaseTokenKeyImpl { - return BaseTokenKeyImpl{ - Kid: s.Kid, - Type: s.Type, - } -} - -var _ json.Marshaler = RsaTokenKey{} - -func (s RsaTokenKey) MarshalJSON() ([]byte, error) { - type wrapper RsaTokenKey - wrapped := wrapper(s) - encoded, err := json.Marshal(wrapped) - if err != nil { - return nil, fmt.Errorf("marshaling RsaTokenKey: %+v", err) - } - - var decoded map[string]interface{} - if err = json.Unmarshal(encoded, &decoded); err != nil { - return nil, fmt.Errorf("unmarshaling RsaTokenKey: %+v", err) - } - - decoded["@type"] = "#Microsoft.VideoAnalyzer.RsaTokenKey" - - encoded, err = json.Marshal(decoded) - if err != nil { - return nil, fmt.Errorf("re-marshaling RsaTokenKey: %+v", err) - } - - return encoded, nil -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_tokenkey.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_tokenkey.go deleted file mode 100644 index c91d555e79f..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_tokenkey.go +++ /dev/null @@ -1,84 +0,0 @@ -package videos - -import ( - "encoding/json" - "fmt" - "strings" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type TokenKey interface { - TokenKey() BaseTokenKeyImpl -} - -var _ TokenKey = BaseTokenKeyImpl{} - -type BaseTokenKeyImpl struct { - Kid string `json:"kid"` - Type string `json:"@type"` -} - -func (s BaseTokenKeyImpl) TokenKey() BaseTokenKeyImpl { - return s -} - -var _ TokenKey = RawTokenKeyImpl{} - -// RawTokenKeyImpl is returned when the Discriminated Value doesn't match any of the defined types -// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) -// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). -type RawTokenKeyImpl struct { - tokenKey BaseTokenKeyImpl - Type string - Values map[string]interface{} -} - -func (s RawTokenKeyImpl) TokenKey() BaseTokenKeyImpl { - return s.tokenKey -} - -func UnmarshalTokenKeyImplementation(input []byte) (TokenKey, error) { - if input == nil { - return nil, nil - } - - var temp map[string]interface{} - if err := json.Unmarshal(input, &temp); err != nil { - return nil, fmt.Errorf("unmarshaling TokenKey into map[string]interface: %+v", err) - } - - var value string - if v, ok := temp["@type"]; ok { - value = fmt.Sprintf("%v", v) - } - - if strings.EqualFold(value, "#Microsoft.VideoAnalyzer.EccTokenKey") { - var out EccTokenKey - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into EccTokenKey: %+v", err) - } - return out, nil - } - - if strings.EqualFold(value, "#Microsoft.VideoAnalyzer.RsaTokenKey") { - var out RsaTokenKey - if err := json.Unmarshal(input, &out); err != nil { - return nil, fmt.Errorf("unmarshaling into RsaTokenKey: %+v", err) - } - return out, nil - } - - var parent BaseTokenKeyImpl - if err := json.Unmarshal(input, &parent); err != nil { - return nil, fmt.Errorf("unmarshaling into BaseTokenKeyImpl: %+v", err) - } - - return RawTokenKeyImpl{ - tokenKey: parent, - Type: value, - Values: temp, - }, nil - -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoentity.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoentity.go deleted file mode 100644 index fa032b6f019..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoentity.go +++ /dev/null @@ -1,16 +0,0 @@ -package videos - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoEntity struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VideoProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoflags.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoflags.go deleted file mode 100644 index 11caf7bc810..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoflags.go +++ /dev/null @@ -1,10 +0,0 @@ -package videos - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoFlags struct { - CanStream bool `json:"canStream"` - HasData bool `json:"hasData"` - IsRecording bool `json:"isRecording"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoproperties.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoproperties.go deleted file mode 100644 index 7596615509a..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videoproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package videos - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoProperties struct { - Description *string `json:"description,omitempty"` - Flags *VideoFlags `json:"flags,omitempty"` - MediaInfo *VideoMediaInfo `json:"mediaInfo,omitempty"` - Streaming *VideoStreaming `json:"streaming,omitempty"` - Title *string `json:"title,omitempty"` - Type *VideoType `json:"type,omitempty"` -} diff --git a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videostreamingtoken.go b/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videostreamingtoken.go deleted file mode 100644 index 4aed13b08a9..00000000000 --- a/resource-manager/videoanalyzer/2021-05-01-preview/videos/model_videostreamingtoken.go +++ /dev/null @@ -1,27 +0,0 @@ -package videos - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VideoStreamingToken struct { - ExpirationDate *string `json:"expirationDate,omitempty"` - Token *string `json:"token,omitempty"` -} - -func (o *VideoStreamingToken) GetExpirationDateAsTime() (*time.Time, error) { - if o.ExpirationDate == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ExpirationDate, "2006-01-02T15:04:05Z07:00") -} - -func (o *VideoStreamingToken) SetExpirationDateAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ExpirationDate = &formatted -}