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/projectresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/projectresource/model_connectioninfo.go index 0465da61fa2..2c2c6b0788a 100644 --- a/resource-manager/datamigration/2025-06-30/projectresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/projectresource/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/projectresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/projectresource/model_mongodbconnectioninfo.go index a3d142d43a1..48be3eb1426 100644 --- a/resource-manager/datamigration/2025-06-30/projectresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/projectresource/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 aab36e3c9aa..f6fdab8b586 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 8f0fa9efafe..c6c4a84ac0e 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/servicetaskresource/model_connectioninfo.go b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go index a2c64b788f0..ec590fac48b 100644 --- a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_connectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/servicetaskresource/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/servicetaskresource/model_mongodbconnectioninfo.go b/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go index 1e1be2df7fa..65db8947ef2 100644 --- a/resource-manager/datamigration/2025-06-30/servicetaskresource/model_mongodbconnectioninfo.go +++ b/resource-manager/datamigration/2025-06-30/servicetaskresource/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 41c28de5b58..75a9f172f04 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 c54f00935ed..7fcca941b2c 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 793caeabedc..c9291fb2fab 100644 --- a/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go @@ -138,8 +138,6 @@ 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" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ 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 6f3a6c4f554..642ecd4a0bd 100644 --- a/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -217,8 +217,6 @@ 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" @@ -227,8 +225,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -251,8 +247,6 @@ 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-07-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2024-07-01/networkmanageractiveconfigurations/constants.go index c9291fb2fab..793caeabedc 100644 --- a/resource-manager/network/2024-07-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-07-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-07-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2024-07-01/networkmanageractiveconnectivityconfigurations/constants.go index 8195863c49a..451770f8cbb 100644 --- a/resource-manager/network/2024-07-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-07-01/networkmanageractiveconnectivityconfigurations/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/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go b/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go index c5bc0377dcd..aa292723727 100644 --- a/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go +++ b/resource-manager/network/2024-07-01/networkmanagereffectiveconnectivityconfiguration/constants.go @@ -340,8 +340,6 @@ 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" @@ -350,8 +348,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -374,8 +370,6 @@ 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-07-01/networkmanagereffectivesecurityadminrules/constants.go b/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go index 6dbd1e6db74..67086d778e3 100644 --- a/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go +++ b/resource-manager/network/2024-07-01/networkmanagereffectivesecurityadminrules/constants.go @@ -138,8 +138,6 @@ 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" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ 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-10-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go index c9291fb2fab..793caeabedc 100644 --- a/resource-manager/network/2024-10-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-10-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-10-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go index 8195863c49a..451770f8cbb 100644 --- a/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-10-01/networkmanageractiveconnectivityconfigurations/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/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2025-01-01/networkmanageractiveconfigurations/constants.go index 793caeabedc..c9291fb2fab 100644 --- a/resource-manager/network/2025-01-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2025-01-01/networkmanageractiveconfigurations/constants.go @@ -138,8 +138,6 @@ 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" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ 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/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2025-01-01/networkmanageractiveconnectivityconfigurations/constants.go index 451770f8cbb..8195863c49a 100644 --- a/resource-manager/network/2025-01-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2025-01-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -340,8 +340,6 @@ 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" @@ -350,8 +348,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -374,8 +370,6 @@ 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/recoveryservices/2025-08-01/client.go b/resource-manager/recoveryservices/2025-08-01/client.go new file mode 100644 index 00000000000..ae57400fcdd --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/client.go @@ -0,0 +1,73 @@ +package v2025_08_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/recoveryservices/2025-08-01/deletedvaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/getoperationresult" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/openapis" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources" + "github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/vaults" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + DeletedVaults *deletedvaults.DeletedVaultsClient + GetOperationResult *getoperationresult.GetOperationResultClient + Openapis *openapis.OpenapisClient + PrivateLinkResourceOperationGroup *privatelinkresourceoperationgroup.PrivateLinkResourceOperationGroupClient + VaultExtendedInfoResources *vaultextendedinforesources.VaultExtendedInfoResourcesClient + Vaults *vaults.VaultsClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + deletedVaultsClient, err := deletedvaults.NewDeletedVaultsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DeletedVaults client: %+v", err) + } + configureFunc(deletedVaultsClient.Client) + + getOperationResultClient, err := getoperationresult.NewGetOperationResultClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building GetOperationResult client: %+v", err) + } + configureFunc(getOperationResultClient.Client) + + openapisClient, err := openapis.NewOpenapisClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Openapis client: %+v", err) + } + configureFunc(openapisClient.Client) + + privateLinkResourceOperationGroupClient, err := privatelinkresourceoperationgroup.NewPrivateLinkResourceOperationGroupClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateLinkResourceOperationGroup client: %+v", err) + } + configureFunc(privateLinkResourceOperationGroupClient.Client) + + vaultExtendedInfoResourcesClient, err := vaultextendedinforesources.NewVaultExtendedInfoResourcesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VaultExtendedInfoResources client: %+v", err) + } + configureFunc(vaultExtendedInfoResourcesClient.Client) + + vaultsClient, err := vaults.NewVaultsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Vaults client: %+v", err) + } + configureFunc(vaultsClient.Client) + + return &Client{ + DeletedVaults: deletedVaultsClient, + GetOperationResult: getOperationResultClient, + Openapis: openapisClient, + PrivateLinkResourceOperationGroup: privateLinkResourceOperationGroupClient, + VaultExtendedInfoResources: vaultExtendedInfoResourcesClient, + Vaults: vaultsClient, + }, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/README.md b/resource-manager/recoveryservices/2025-08-01/deletedvaults/README.md new file mode 100644 index 00000000000..98652e85cd2 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/deletedvaults` Documentation + +The `deletedvaults` SDK allows for interaction with Azure Resource Manager `recoveryservices` (API Version `2025-08-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/recoveryservices/2025-08-01/deletedvaults" +``` + + +### Client Initialization + +```go +client := deletedvaults.NewDeletedVaultsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DeletedVaultsClient.Get` + +```go +ctx := context.TODO() +id := deletedvaults.NewDeletedVaultID("12345678-1234-9876-4563-123456789012", "locationName", "deletedVaultName") + +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: `DeletedVaultsClient.GetOperationStatus` + +```go +ctx := context.TODO() +id := deletedvaults.NewOperationID("12345678-1234-9876-4563-123456789012", "locationName", "deletedVaultName", "operationId") + +read, err := client.GetOperationStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DeletedVaultsClient.ListBySubscriptionId` + +```go +ctx := context.TODO() +id := deletedvaults.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListBySubscriptionId(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionIdComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DeletedVaultsClient.Undelete` + +```go +ctx := context.TODO() +id := deletedvaults.NewDeletedVaultID("12345678-1234-9876-4563-123456789012", "locationName", "deletedVaultName") + +payload := deletedvaults.DeletedVaultUndeleteInput{ + // ... +} + + +if err := client.UndeleteThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/client.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/client.go new file mode 100644 index 00000000000..54089e656c0 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/client.go @@ -0,0 +1,26 @@ +package deletedvaults + +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 DeletedVaultsClient struct { + Client *resourcemanager.Client +} + +func NewDeletedVaultsClientWithBaseURI(sdkApi sdkEnv.Api) (*DeletedVaultsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "deletedvaults", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DeletedVaultsClient: %+v", err) + } + + return &DeletedVaultsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_deletedvault.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_deletedvault.go new file mode 100644 index 00000000000..b3f9b4941b7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_deletedvault.go @@ -0,0 +1,130 @@ +package deletedvaults + +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(&DeletedVaultId{}) +} + +var _ resourceids.ResourceId = &DeletedVaultId{} + +// DeletedVaultId is a struct representing the Resource ID for a Deleted Vault +type DeletedVaultId struct { + SubscriptionId string + LocationName string + DeletedVaultName string +} + +// NewDeletedVaultID returns a new DeletedVaultId struct +func NewDeletedVaultID(subscriptionId string, locationName string, deletedVaultName string) DeletedVaultId { + return DeletedVaultId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + DeletedVaultName: deletedVaultName, + } +} + +// ParseDeletedVaultID parses 'input' into a DeletedVaultId +func ParseDeletedVaultID(input string) (*DeletedVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&DeletedVaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DeletedVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseDeletedVaultIDInsensitively parses 'input' case-insensitively into a DeletedVaultId +// note: this method should only be used for API response data and not user input +func ParseDeletedVaultIDInsensitively(input string) (*DeletedVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&DeletedVaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := DeletedVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *DeletedVaultId) 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) + } + + if id.DeletedVaultName, ok = input.Parsed["deletedVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", input) + } + + return nil +} + +// ValidateDeletedVaultID checks that 'input' can be parsed as a Deleted Vault ID +func ValidateDeletedVaultID(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 := ParseDeletedVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Deleted Vault ID +func (id DeletedVaultId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.RecoveryServices/locations/%s/deletedVaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DeletedVaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Deleted Vault ID +func (id DeletedVaultId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticDeletedVaults", "deletedVaults", "deletedVaults"), + resourceids.UserSpecifiedSegment("deletedVaultName", "deletedVaultName"), + } +} + +// String returns a human-readable description of this Deleted Vault ID +func (id DeletedVaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Deleted Vault Name: %q", id.DeletedVaultName), + } + return fmt.Sprintf("Deleted Vault (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_deletedvault_test.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_deletedvault_test.go new file mode 100644 index 00000000000..d7a70eb87f0 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_deletedvault_test.go @@ -0,0 +1,282 @@ +package deletedvaults + +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 = &DeletedVaultId{} + +func TestNewDeletedVaultID(t *testing.T) { + id := NewDeletedVaultID("12345678-1234-9876-4563-123456789012", "locationName", "deletedVaultName") + + 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") + } + + if id.DeletedVaultName != "deletedVaultName" { + t.Fatalf("Expected %q but got %q for Segment 'DeletedVaultName'", id.DeletedVaultName, "deletedVaultName") + } +} + +func TestFormatDeletedVaultID(t *testing.T) { + actual := NewDeletedVaultID("12345678-1234-9876-4563-123456789012", "locationName", "deletedVaultName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseDeletedVaultID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DeletedVaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName", + Expected: &DeletedVaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DeletedVaultName: "deletedVaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDeletedVaultID(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) + } + + if actual.DeletedVaultName != v.Expected.DeletedVaultName { + t.Fatalf("Expected %q but got %q for DeletedVaultName", v.Expected.DeletedVaultName, actual.DeletedVaultName) + } + + } +} + +func TestParseDeletedVaultIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *DeletedVaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName", + Expected: &DeletedVaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DeletedVaultName: "deletedVaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs/dElEtEdVaUlTnAmE", + Expected: &DeletedVaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + DeletedVaultName: "dElEtEdVaUlTnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs/dElEtEdVaUlTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseDeletedVaultIDInsensitively(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) + } + + if actual.DeletedVaultName != v.Expected.DeletedVaultName { + t.Fatalf("Expected %q but got %q for DeletedVaultName", v.Expected.DeletedVaultName, actual.DeletedVaultName) + } + + } +} + +func TestSegmentsForDeletedVaultId(t *testing.T) { + segments := DeletedVaultId{}.Segments() + if len(segments) == 0 { + t.Fatalf("DeletedVaultId 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/recoveryservices/2025-08-01/deletedvaults/id_location.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_location.go new file mode 100644 index 00000000000..5b7dc90c6b0 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_location.go @@ -0,0 +1,121 @@ +package deletedvaults + +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.RecoveryServices/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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + 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/recoveryservices/2025-08-01/deletedvaults/id_location_test.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_location_test.go new file mode 100644 index 00000000000..9c16bbae8ca --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_location_test.go @@ -0,0 +1,237 @@ +package deletedvaults + +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.RecoveryServices/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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/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.RecoveryServices/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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/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.RecoveryServices/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/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.rEcOvErYsErViCeS/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/recoveryservices/2025-08-01/deletedvaults/id_operation.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_operation.go new file mode 100644 index 00000000000..c138a8ce944 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_operation.go @@ -0,0 +1,139 @@ +package deletedvaults + +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(&OperationId{}) +} + +var _ resourceids.ResourceId = &OperationId{} + +// OperationId is a struct representing the Resource ID for a Operation +type OperationId struct { + SubscriptionId string + LocationName string + DeletedVaultName string + OperationId string +} + +// NewOperationID returns a new OperationId struct +func NewOperationID(subscriptionId string, locationName string, deletedVaultName string, operationId string) OperationId { + return OperationId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + DeletedVaultName: deletedVaultName, + OperationId: operationId, + } +} + +// ParseOperationID parses 'input' into a OperationId +func ParseOperationID(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(&OperationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OperationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOperationIDInsensitively parses 'input' case-insensitively into a OperationId +// note: this method should only be used for API response data and not user input +func ParseOperationIDInsensitively(input string) (*OperationId, error) { + parser := resourceids.NewParserFromResourceIdType(&OperationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OperationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OperationId) 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) + } + + if id.DeletedVaultName, ok = input.Parsed["deletedVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "deletedVaultName", input) + } + + if id.OperationId, ok = input.Parsed["operationId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "operationId", input) + } + + return nil +} + +// ValidateOperationID checks that 'input' can be parsed as a Operation ID +func ValidateOperationID(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 := ParseOperationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Operation ID +func (id OperationId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.RecoveryServices/locations/%s/deletedVaults/%s/operations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.DeletedVaultName, id.OperationId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Operation ID +func (id OperationId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticDeletedVaults", "deletedVaults", "deletedVaults"), + resourceids.UserSpecifiedSegment("deletedVaultName", "deletedVaultName"), + resourceids.StaticSegment("staticOperations", "operations", "operations"), + resourceids.UserSpecifiedSegment("operationId", "operationId"), + } +} + +// String returns a human-readable description of this Operation ID +func (id OperationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Deleted Vault Name: %q", id.DeletedVaultName), + fmt.Sprintf("Operation: %q", id.OperationId), + } + return fmt.Sprintf("Operation (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_operation_test.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_operation_test.go new file mode 100644 index 00000000000..04884092adc --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/id_operation_test.go @@ -0,0 +1,327 @@ +package deletedvaults + +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 = &OperationId{} + +func TestNewOperationID(t *testing.T) { + id := NewOperationID("12345678-1234-9876-4563-123456789012", "locationName", "deletedVaultName", "operationId") + + 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") + } + + if id.DeletedVaultName != "deletedVaultName" { + t.Fatalf("Expected %q but got %q for Segment 'DeletedVaultName'", id.DeletedVaultName, "deletedVaultName") + } + + if id.OperationId != "operationId" { + t.Fatalf("Expected %q but got %q for Segment 'OperationId'", id.OperationId, "operationId") + } +} + +func TestFormatOperationID(t *testing.T) { + actual := NewOperationID("12345678-1234-9876-4563-123456789012", "locationName", "deletedVaultName", "operationId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/operations/operationId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseOperationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OperationId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/operations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/operations/operationId", + Expected: &OperationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DeletedVaultName: "deletedVaultName", + OperationId: "operationId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/operations/operationId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOperationID(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) + } + + if actual.DeletedVaultName != v.Expected.DeletedVaultName { + t.Fatalf("Expected %q but got %q for DeletedVaultName", v.Expected.DeletedVaultName, actual.DeletedVaultName) + } + + if actual.OperationId != v.Expected.OperationId { + t.Fatalf("Expected %q but got %q for OperationId", v.Expected.OperationId, actual.OperationId) + } + + } +} + +func TestParseOperationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OperationId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs/dElEtEdVaUlTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/operations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs/dElEtEdVaUlTnAmE/oPeRaTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/operations/operationId", + Expected: &OperationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + DeletedVaultName: "deletedVaultName", + OperationId: "operationId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations/locationName/deletedVaults/deletedVaultName/operations/operationId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs/dElEtEdVaUlTnAmE/oPeRaTiOnS/oPeRaTiOnId", + Expected: &OperationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + DeletedVaultName: "dElEtEdVaUlTnAmE", + OperationId: "oPeRaTiOnId", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/dElEtEdVaUlTs/dElEtEdVaUlTnAmE/oPeRaTiOnS/oPeRaTiOnId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOperationIDInsensitively(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) + } + + if actual.DeletedVaultName != v.Expected.DeletedVaultName { + t.Fatalf("Expected %q but got %q for DeletedVaultName", v.Expected.DeletedVaultName, actual.DeletedVaultName) + } + + if actual.OperationId != v.Expected.OperationId { + t.Fatalf("Expected %q but got %q for OperationId", v.Expected.OperationId, actual.OperationId) + } + + } +} + +func TestSegmentsForOperationId(t *testing.T) { + segments := OperationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("OperationId 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/recoveryservices/2025-08-01/deletedvaults/method_get.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_get.go new file mode 100644 index 00000000000..73118cd3b2a --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_get.go @@ -0,0 +1,53 @@ +package deletedvaults + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DeletedVault +} + +// Get ... +func (c DeletedVaultsClient) Get(ctx context.Context, id DeletedVaultId) (result GetOperationResponse, 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 DeletedVault + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_getoperationstatus.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_getoperationstatus.go new file mode 100644 index 00000000000..6eacd8aaf24 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_getoperationstatus.go @@ -0,0 +1,53 @@ +package deletedvaults + +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 GetOperationStatusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *OperationResource +} + +// GetOperationStatus ... +func (c DeletedVaultsClient) GetOperationStatus(ctx context.Context, id OperationId) (result GetOperationStatusOperationResponse, 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 OperationResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_listbysubscriptionid.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_listbysubscriptionid.go new file mode 100644 index 00000000000..a784b1402c7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_listbysubscriptionid.go @@ -0,0 +1,105 @@ +package deletedvaults + +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 ListBySubscriptionIdOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DeletedVault +} + +type ListBySubscriptionIdCompleteResult struct { + LatestHttpResponse *http.Response + Items []DeletedVault +} + +type ListBySubscriptionIdCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionIdCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscriptionId ... +func (c DeletedVaultsClient) ListBySubscriptionId(ctx context.Context, id LocationId) (result ListBySubscriptionIdOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionIdCustomPager{}, + Path: fmt.Sprintf("%s/deletedVaults", 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 *[]DeletedVault `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionIdComplete retrieves all the results into a single object +func (c DeletedVaultsClient) ListBySubscriptionIdComplete(ctx context.Context, id LocationId) (ListBySubscriptionIdCompleteResult, error) { + return c.ListBySubscriptionIdCompleteMatchingPredicate(ctx, id, DeletedVaultOperationPredicate{}) +} + +// ListBySubscriptionIdCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DeletedVaultsClient) ListBySubscriptionIdCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate DeletedVaultOperationPredicate) (result ListBySubscriptionIdCompleteResult, err error) { + items := make([]DeletedVault, 0) + + resp, err := c.ListBySubscriptionId(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 = ListBySubscriptionIdCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_undelete.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_undelete.go new file mode 100644 index 00000000000..d075578d0d7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/method_undelete.go @@ -0,0 +1,75 @@ +package deletedvaults + +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 UndeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DeletedVault +} + +// Undelete ... +func (c DeletedVaultsClient) Undelete(ctx context.Context, id DeletedVaultId, input DeletedVaultUndeleteInput) (result UndeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/undelete", 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 +} + +// UndeleteThenPoll performs Undelete then polls until it's completed +func (c DeletedVaultsClient) UndeleteThenPoll(ctx context.Context, id DeletedVaultId, input DeletedVaultUndeleteInput) error { + result, err := c.Undelete(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Undelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Undelete: %+v", err) + } + + return nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvault.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvault.go new file mode 100644 index 00000000000..0549df46de2 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvault.go @@ -0,0 +1,16 @@ +package deletedvaults + +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 DeletedVault struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *DeletedVaultProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultproperties.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultproperties.go new file mode 100644 index 00000000000..a3bf572f724 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultproperties.go @@ -0,0 +1,40 @@ +package deletedvaults + +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 DeletedVaultProperties struct { + PurgeAt *string `json:"purgeAt,omitempty"` + VaultDeletionTime *string `json:"vaultDeletionTime,omitempty"` + VaultId *string `json:"vaultId,omitempty"` +} + +func (o *DeletedVaultProperties) GetPurgeAtAsTime() (*time.Time, error) { + if o.PurgeAt == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PurgeAt, "2006-01-02T15:04:05Z07:00") +} + +func (o *DeletedVaultProperties) SetPurgeAtAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PurgeAt = &formatted +} + +func (o *DeletedVaultProperties) GetVaultDeletionTimeAsTime() (*time.Time, error) { + if o.VaultDeletionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.VaultDeletionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DeletedVaultProperties) SetVaultDeletionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.VaultDeletionTime = &formatted +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultundeleteinput.go similarity index 52% rename from resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go rename to resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultundeleteinput.go index 8e707921e70..78b3acc5f0a 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_erroradditionalinfo.go +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultundeleteinput.go @@ -1,9 +1,8 @@ -package protecteditems +package deletedvaults // 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"` +type DeletedVaultUndeleteInput struct { + Properties DeletedVaultUndeleteInputProperties `json:"properties"` } diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_erroradditionalinfo.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultundeleteinputproperties.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_erroradditionalinfo.go rename to resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultundeleteinputproperties.go index 8e24f9a7b12..8a8e4724473 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_erroradditionalinfo.go +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_deletedvaultundeleteinputproperties.go @@ -1,9 +1,8 @@ -package protectioncontainers +package deletedvaults // 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"` +type DeletedVaultUndeleteInputProperties struct { + RecoveryResourceGroupId string `json:"recoveryResourceGroupId"` } diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_error.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_error.go new file mode 100644 index 00000000000..6c2fb22a426 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_error.go @@ -0,0 +1,12 @@ +package deletedvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Error struct { + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` + Code *string `json:"code,omitempty"` + Details *[]Error `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/recoveryservices/2025-08-01/deletedvaults/model_erroradditionalinfo.go similarity index 92% rename from resource-manager/recoveryservicesbackup/2025-08-01/operation/model_erroradditionalinfo.go rename to resource-manager/recoveryservices/2025-08-01/deletedvaults/model_erroradditionalinfo.go index 9ab2947bdeb..4bacf0ce7fb 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_erroradditionalinfo.go +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_erroradditionalinfo.go @@ -1,4 +1,4 @@ -package operation +package deletedvaults // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_operationresource.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_operationresource.go new file mode 100644 index 00000000000..05547bc6d3a --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/model_operationresource.go @@ -0,0 +1,43 @@ +package deletedvaults + +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 OperationResource struct { + EndTime *string `json:"endTime,omitempty"` + Error *Error `json:"error,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *string `json:"status,omitempty"` +} + +func (o *OperationResource) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResource) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *OperationResource) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *OperationResource) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/recoveryservices/2025-08-01/deletedvaults/predicates.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/predicates.go new file mode 100644 index 00000000000..1c1084d59c6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/predicates.go @@ -0,0 +1,27 @@ +package deletedvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeletedVaultOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p DeletedVaultOperationPredicate) Matches(input DeletedVault) 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/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_erroradditionalinfo.go b/resource-manager/recoveryservices/2025-08-01/deletedvaults/version.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_erroradditionalinfo.go rename to resource-manager/recoveryservices/2025-08-01/deletedvaults/version.go index 30f15bc8fa3..e9dceaf719d 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_erroradditionalinfo.go +++ b/resource-manager/recoveryservices/2025-08-01/deletedvaults/version.go @@ -1,9 +1,10 @@ -package softdeletedcontainers +package deletedvaults // 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"` +const defaultApiVersion = "2025-08-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/deletedvaults/2025-08-01" } diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/README.md b/resource-manager/recoveryservices/2025-08-01/getoperationresult/README.md new file mode 100644 index 00000000000..0e5bfea32db --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/README.md @@ -0,0 +1,38 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/getoperationresult` Documentation + +The `getoperationresult` SDK allows for interaction with Azure Resource Manager `recoveryservices` (API Version `2025-08-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/recoveryservices/2025-08-01/getoperationresult" +``` + + +### Client Initialization + +```go +client := getoperationresult.NewGetOperationResultClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GetOperationResultClient.VaultsListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.VaultsListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.VaultsListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/client.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/client.go new file mode 100644 index 00000000000..370c4ae337e --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/client.go @@ -0,0 +1,26 @@ +package getoperationresult + +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 GetOperationResultClient struct { + Client *resourcemanager.Client +} + +func NewGetOperationResultClientWithBaseURI(sdkApi sdkEnv.Api) (*GetOperationResultClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "getoperationresult", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GetOperationResultClient: %+v", err) + } + + return &GetOperationResultClient{ + Client: client, + }, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/constants.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/constants.go new file mode 100644 index 00000000000..ccbd0aced24 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/constants.go @@ -0,0 +1,1043 @@ +package getoperationresult + +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 AlertsState string + +const ( + AlertsStateDisabled AlertsState = "Disabled" + AlertsStateEnabled AlertsState = "Enabled" +) + +func PossibleValuesForAlertsState() []string { + return []string{ + string(AlertsStateDisabled), + string(AlertsStateEnabled), + } +} + +func (s *AlertsState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlertsState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAlertsState(input string) (*AlertsState, error) { + vals := map[string]AlertsState{ + "disabled": AlertsStateDisabled, + "enabled": AlertsStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlertsState(input) + return &out, nil +} + +type BCDRSecurityLevel string + +const ( + BCDRSecurityLevelExcellent BCDRSecurityLevel = "Excellent" + BCDRSecurityLevelFair BCDRSecurityLevel = "Fair" + BCDRSecurityLevelGood BCDRSecurityLevel = "Good" + BCDRSecurityLevelPoor BCDRSecurityLevel = "Poor" +) + +func PossibleValuesForBCDRSecurityLevel() []string { + return []string{ + string(BCDRSecurityLevelExcellent), + string(BCDRSecurityLevelFair), + string(BCDRSecurityLevelGood), + string(BCDRSecurityLevelPoor), + } +} + +func (s *BCDRSecurityLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBCDRSecurityLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBCDRSecurityLevel(input string) (*BCDRSecurityLevel, error) { + vals := map[string]BCDRSecurityLevel{ + "excellent": BCDRSecurityLevelExcellent, + "fair": BCDRSecurityLevelFair, + "good": BCDRSecurityLevelGood, + "poor": BCDRSecurityLevelPoor, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BCDRSecurityLevel(input) + return &out, nil +} + +type BackupStorageVersion string + +const ( + BackupStorageVersionUnassigned BackupStorageVersion = "Unassigned" + BackupStorageVersionVOne BackupStorageVersion = "V1" + BackupStorageVersionVTwo BackupStorageVersion = "V2" +) + +func PossibleValuesForBackupStorageVersion() []string { + return []string{ + string(BackupStorageVersionUnassigned), + string(BackupStorageVersionVOne), + string(BackupStorageVersionVTwo), + } +} + +func (s *BackupStorageVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackupStorageVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBackupStorageVersion(input string) (*BackupStorageVersion, error) { + vals := map[string]BackupStorageVersion{ + "unassigned": BackupStorageVersionUnassigned, + "v1": BackupStorageVersionVOne, + "v2": BackupStorageVersionVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackupStorageVersion(input) + return &out, nil +} + +type CrossRegionRestore string + +const ( + CrossRegionRestoreDisabled CrossRegionRestore = "Disabled" + CrossRegionRestoreEnabled CrossRegionRestore = "Enabled" +) + +func PossibleValuesForCrossRegionRestore() []string { + return []string{ + string(CrossRegionRestoreDisabled), + string(CrossRegionRestoreEnabled), + } +} + +func (s *CrossRegionRestore) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCrossRegionRestore(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCrossRegionRestore(input string) (*CrossRegionRestore, error) { + vals := map[string]CrossRegionRestore{ + "disabled": CrossRegionRestoreDisabled, + "enabled": CrossRegionRestoreEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CrossRegionRestore(input) + return &out, nil +} + +type CrossSubscriptionRestoreState string + +const ( + CrossSubscriptionRestoreStateDisabled CrossSubscriptionRestoreState = "Disabled" + CrossSubscriptionRestoreStateEnabled CrossSubscriptionRestoreState = "Enabled" + CrossSubscriptionRestoreStatePermanentlyDisabled CrossSubscriptionRestoreState = "PermanentlyDisabled" +) + +func PossibleValuesForCrossSubscriptionRestoreState() []string { + return []string{ + string(CrossSubscriptionRestoreStateDisabled), + string(CrossSubscriptionRestoreStateEnabled), + string(CrossSubscriptionRestoreStatePermanentlyDisabled), + } +} + +func (s *CrossSubscriptionRestoreState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCrossSubscriptionRestoreState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCrossSubscriptionRestoreState(input string) (*CrossSubscriptionRestoreState, error) { + vals := map[string]CrossSubscriptionRestoreState{ + "disabled": CrossSubscriptionRestoreStateDisabled, + "enabled": CrossSubscriptionRestoreStateEnabled, + "permanentlydisabled": CrossSubscriptionRestoreStatePermanentlyDisabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CrossSubscriptionRestoreState(input) + return &out, nil +} + +type EnhancedSecurityState string + +const ( + EnhancedSecurityStateAlwaysON EnhancedSecurityState = "AlwaysON" + EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled" + EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled" + EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid" +) + +func PossibleValuesForEnhancedSecurityState() []string { + return []string{ + string(EnhancedSecurityStateAlwaysON), + string(EnhancedSecurityStateDisabled), + string(EnhancedSecurityStateEnabled), + string(EnhancedSecurityStateInvalid), + } +} + +func (s *EnhancedSecurityState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEnhancedSecurityState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEnhancedSecurityState(input string) (*EnhancedSecurityState, error) { + vals := map[string]EnhancedSecurityState{ + "alwayson": EnhancedSecurityStateAlwaysON, + "disabled": EnhancedSecurityStateDisabled, + "enabled": EnhancedSecurityStateEnabled, + "invalid": EnhancedSecurityStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnhancedSecurityState(input) + return &out, nil +} + +type IdentityType string + +const ( + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +func PossibleValuesForIdentityType() []string { + return []string{ + string(IdentityTypeSystemAssigned), + string(IdentityTypeUserAssigned), + } +} + +func (s *IdentityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIdentityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIdentityType(input string) (*IdentityType, error) { + vals := map[string]IdentityType{ + "systemassigned": IdentityTypeSystemAssigned, + "userassigned": IdentityTypeUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IdentityType(input) + return &out, nil +} + +type ImmutabilityState string + +const ( + ImmutabilityStateDisabled ImmutabilityState = "Disabled" + ImmutabilityStateLocked ImmutabilityState = "Locked" + ImmutabilityStateUnlocked ImmutabilityState = "Unlocked" +) + +func PossibleValuesForImmutabilityState() []string { + return []string{ + string(ImmutabilityStateDisabled), + string(ImmutabilityStateLocked), + string(ImmutabilityStateUnlocked), + } +} + +func (s *ImmutabilityState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseImmutabilityState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseImmutabilityState(input string) (*ImmutabilityState, error) { + vals := map[string]ImmutabilityState{ + "disabled": ImmutabilityStateDisabled, + "locked": ImmutabilityStateLocked, + "unlocked": ImmutabilityStateUnlocked, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ImmutabilityState(input) + return &out, nil +} + +type InfrastructureEncryptionState string + +const ( + InfrastructureEncryptionStateDisabled InfrastructureEncryptionState = "Disabled" + InfrastructureEncryptionStateEnabled InfrastructureEncryptionState = "Enabled" +) + +func PossibleValuesForInfrastructureEncryptionState() []string { + return []string{ + string(InfrastructureEncryptionStateDisabled), + string(InfrastructureEncryptionStateEnabled), + } +} + +func (s *InfrastructureEncryptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInfrastructureEncryptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInfrastructureEncryptionState(input string) (*InfrastructureEncryptionState, error) { + vals := map[string]InfrastructureEncryptionState{ + "disabled": InfrastructureEncryptionStateDisabled, + "enabled": InfrastructureEncryptionStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryptionState(input) + return &out, nil +} + +type MultiUserAuthorization string + +const ( + MultiUserAuthorizationDisabled MultiUserAuthorization = "Disabled" + MultiUserAuthorizationEnabled MultiUserAuthorization = "Enabled" + MultiUserAuthorizationInvalid MultiUserAuthorization = "Invalid" +) + +func PossibleValuesForMultiUserAuthorization() []string { + return []string{ + string(MultiUserAuthorizationDisabled), + string(MultiUserAuthorizationEnabled), + string(MultiUserAuthorizationInvalid), + } +} + +func (s *MultiUserAuthorization) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMultiUserAuthorization(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMultiUserAuthorization(input string) (*MultiUserAuthorization, error) { + vals := map[string]MultiUserAuthorization{ + "disabled": MultiUserAuthorizationDisabled, + "enabled": MultiUserAuthorizationEnabled, + "invalid": MultiUserAuthorizationInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MultiUserAuthorization(input) + return &out, nil +} + +type PrivateEndpointConnectionStatus string + +const ( + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointConnectionStatus() []string { + return []string{ + string(PrivateEndpointConnectionStatusApproved), + string(PrivateEndpointConnectionStatusDisconnected), + string(PrivateEndpointConnectionStatusPending), + string(PrivateEndpointConnectionStatusRejected), + } +} + +func (s *PrivateEndpointConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionStatus(input string) (*PrivateEndpointConnectionStatus, error) { + vals := map[string]PrivateEndpointConnectionStatus{ + "approved": PrivateEndpointConnectionStatusApproved, + "disconnected": PrivateEndpointConnectionStatusDisconnected, + "pending": PrivateEndpointConnectionStatusPending, + "rejected": PrivateEndpointConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStatePending ProvisioningState = "Pending" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStatePending), + string(ProvisioningStateSucceeded), + } +} + +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{ + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "pending": ProvisioningStatePending, + "succeeded": ProvisioningStateSucceeded, + } + 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 ResourceMoveState string + +const ( + ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" + ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" + ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" + ResourceMoveStateFailure ResourceMoveState = "Failure" + ResourceMoveStateInProgress ResourceMoveState = "InProgress" + ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" + ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" + ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" + ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" + ResourceMoveStateUnknown ResourceMoveState = "Unknown" +) + +func PossibleValuesForResourceMoveState() []string { + return []string{ + string(ResourceMoveStateCommitFailed), + string(ResourceMoveStateCommitTimedout), + string(ResourceMoveStateCriticalFailure), + string(ResourceMoveStateFailure), + string(ResourceMoveStateInProgress), + string(ResourceMoveStateMoveSucceeded), + string(ResourceMoveStatePartialSuccess), + string(ResourceMoveStatePrepareFailed), + string(ResourceMoveStatePrepareTimedout), + string(ResourceMoveStateUnknown), + } +} + +func (s *ResourceMoveState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceMoveState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceMoveState(input string) (*ResourceMoveState, error) { + vals := map[string]ResourceMoveState{ + "commitfailed": ResourceMoveStateCommitFailed, + "committimedout": ResourceMoveStateCommitTimedout, + "criticalfailure": ResourceMoveStateCriticalFailure, + "failure": ResourceMoveStateFailure, + "inprogress": ResourceMoveStateInProgress, + "movesucceeded": ResourceMoveStateMoveSucceeded, + "partialsuccess": ResourceMoveStatePartialSuccess, + "preparefailed": ResourceMoveStatePrepareFailed, + "preparetimedout": ResourceMoveStatePrepareTimedout, + "unknown": ResourceMoveStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceMoveState(input) + return &out, nil +} + +type SecureScoreLevel string + +const ( + SecureScoreLevelAdequate SecureScoreLevel = "Adequate" + SecureScoreLevelMaximum SecureScoreLevel = "Maximum" + SecureScoreLevelMinimum SecureScoreLevel = "Minimum" + SecureScoreLevelNone SecureScoreLevel = "None" +) + +func PossibleValuesForSecureScoreLevel() []string { + return []string{ + string(SecureScoreLevelAdequate), + string(SecureScoreLevelMaximum), + string(SecureScoreLevelMinimum), + string(SecureScoreLevelNone), + } +} + +func (s *SecureScoreLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecureScoreLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecureScoreLevel(input string) (*SecureScoreLevel, error) { + vals := map[string]SecureScoreLevel{ + "adequate": SecureScoreLevelAdequate, + "maximum": SecureScoreLevelMaximum, + "minimum": SecureScoreLevelMinimum, + "none": SecureScoreLevelNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecureScoreLevel(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameRSZero SkuName = "RS0" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameRSZero), + string(SkuNameStandard), + } +} + +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{ + "rs0": SkuNameRSZero, + "standard": SkuNameStandard, + } + 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 SoftDeleteState string + +const ( + SoftDeleteStateAlwaysON SoftDeleteState = "AlwaysON" + SoftDeleteStateDisabled SoftDeleteState = "Disabled" + SoftDeleteStateEnabled SoftDeleteState = "Enabled" + SoftDeleteStateInvalid SoftDeleteState = "Invalid" +) + +func PossibleValuesForSoftDeleteState() []string { + return []string{ + string(SoftDeleteStateAlwaysON), + string(SoftDeleteStateDisabled), + string(SoftDeleteStateEnabled), + string(SoftDeleteStateInvalid), + } +} + +func (s *SoftDeleteState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSoftDeleteState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSoftDeleteState(input string) (*SoftDeleteState, error) { + vals := map[string]SoftDeleteState{ + "alwayson": SoftDeleteStateAlwaysON, + "disabled": SoftDeleteStateDisabled, + "enabled": SoftDeleteStateEnabled, + "invalid": SoftDeleteStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftDeleteState(input) + return &out, nil +} + +type StandardTierStorageRedundancy string + +const ( + StandardTierStorageRedundancyGeoRedundant StandardTierStorageRedundancy = "GeoRedundant" + StandardTierStorageRedundancyInvalid StandardTierStorageRedundancy = "Invalid" + StandardTierStorageRedundancyLocallyRedundant StandardTierStorageRedundancy = "LocallyRedundant" + StandardTierStorageRedundancyZoneRedundant StandardTierStorageRedundancy = "ZoneRedundant" +) + +func PossibleValuesForStandardTierStorageRedundancy() []string { + return []string{ + string(StandardTierStorageRedundancyGeoRedundant), + string(StandardTierStorageRedundancyInvalid), + string(StandardTierStorageRedundancyLocallyRedundant), + string(StandardTierStorageRedundancyZoneRedundant), + } +} + +func (s *StandardTierStorageRedundancy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStandardTierStorageRedundancy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStandardTierStorageRedundancy(input string) (*StandardTierStorageRedundancy, error) { + vals := map[string]StandardTierStorageRedundancy{ + "georedundant": StandardTierStorageRedundancyGeoRedundant, + "invalid": StandardTierStorageRedundancyInvalid, + "locallyredundant": StandardTierStorageRedundancyLocallyRedundant, + "zoneredundant": StandardTierStorageRedundancyZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StandardTierStorageRedundancy(input) + return &out, nil +} + +type State string + +const ( + StateDisabled State = "Disabled" + StateEnabled State = "Enabled" + StateInvalid State = "Invalid" +) + +func PossibleValuesForState() []string { + return []string{ + string(StateDisabled), + string(StateEnabled), + string(StateInvalid), + } +} + +func (s *State) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseState(input string) (*State, error) { + vals := map[string]State{ + "disabled": StateDisabled, + "enabled": StateEnabled, + "invalid": StateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := State(input) + return &out, nil +} + +type TriggerType string + +const ( + TriggerTypeForcedUpgrade TriggerType = "ForcedUpgrade" + TriggerTypeUserTriggered TriggerType = "UserTriggered" +) + +func PossibleValuesForTriggerType() []string { + return []string{ + string(TriggerTypeForcedUpgrade), + string(TriggerTypeUserTriggered), + } +} + +func (s *TriggerType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTriggerType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTriggerType(input string) (*TriggerType, error) { + vals := map[string]TriggerType{ + "forcedupgrade": TriggerTypeForcedUpgrade, + "usertriggered": TriggerTypeUserTriggered, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggerType(input) + return &out, nil +} + +type VaultPrivateEndpointState string + +const ( + VaultPrivateEndpointStateEnabled VaultPrivateEndpointState = "Enabled" + VaultPrivateEndpointStateNone VaultPrivateEndpointState = "None" +) + +func PossibleValuesForVaultPrivateEndpointState() []string { + return []string{ + string(VaultPrivateEndpointStateEnabled), + string(VaultPrivateEndpointStateNone), + } +} + +func (s *VaultPrivateEndpointState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVaultPrivateEndpointState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVaultPrivateEndpointState(input string) (*VaultPrivateEndpointState, error) { + vals := map[string]VaultPrivateEndpointState{ + "enabled": VaultPrivateEndpointStateEnabled, + "none": VaultPrivateEndpointStateNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultPrivateEndpointState(input) + return &out, nil +} + +type VaultSubResourceType string + +const ( + VaultSubResourceTypeAzureBackup VaultSubResourceType = "AzureBackup" + VaultSubResourceTypeAzureBackupSecondary VaultSubResourceType = "AzureBackup_secondary" + VaultSubResourceTypeAzureSiteRecovery VaultSubResourceType = "AzureSiteRecovery" +) + +func PossibleValuesForVaultSubResourceType() []string { + return []string{ + string(VaultSubResourceTypeAzureBackup), + string(VaultSubResourceTypeAzureBackupSecondary), + string(VaultSubResourceTypeAzureSiteRecovery), + } +} + +func (s *VaultSubResourceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVaultSubResourceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVaultSubResourceType(input string) (*VaultSubResourceType, error) { + vals := map[string]VaultSubResourceType{ + "azurebackup": VaultSubResourceTypeAzureBackup, + "azurebackup_secondary": VaultSubResourceTypeAzureBackupSecondary, + "azuresiterecovery": VaultSubResourceTypeAzureSiteRecovery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultSubResourceType(input) + return &out, nil +} + +type VaultUpgradeState string + +const ( + VaultUpgradeStateFailed VaultUpgradeState = "Failed" + VaultUpgradeStateInProgress VaultUpgradeState = "InProgress" + VaultUpgradeStateUnknown VaultUpgradeState = "Unknown" + VaultUpgradeStateUpgraded VaultUpgradeState = "Upgraded" +) + +func PossibleValuesForVaultUpgradeState() []string { + return []string{ + string(VaultUpgradeStateFailed), + string(VaultUpgradeStateInProgress), + string(VaultUpgradeStateUnknown), + string(VaultUpgradeStateUpgraded), + } +} + +func (s *VaultUpgradeState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVaultUpgradeState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVaultUpgradeState(input string) (*VaultUpgradeState, error) { + vals := map[string]VaultUpgradeState{ + "failed": VaultUpgradeStateFailed, + "inprogress": VaultUpgradeStateInProgress, + "unknown": VaultUpgradeStateUnknown, + "upgraded": VaultUpgradeStateUpgraded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultUpgradeState(input) + return &out, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/method_vaultslistbyresourcegroup.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/method_vaultslistbyresourcegroup.go new file mode 100644 index 00000000000..58cbe71ab43 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/method_vaultslistbyresourcegroup.go @@ -0,0 +1,106 @@ +package getoperationresult + +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 VaultsListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Vault +} + +type VaultsListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Vault +} + +type VaultsListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *VaultsListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// VaultsListByResourceGroup ... +func (c GetOperationResultClient) VaultsListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result VaultsListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &VaultsListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.RecoveryServices/vaults", 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 *[]Vault `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VaultsListByResourceGroupComplete retrieves all the results into a single object +func (c GetOperationResultClient) VaultsListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (VaultsListByResourceGroupCompleteResult, error) { + return c.VaultsListByResourceGroupCompleteMatchingPredicate(ctx, id, VaultOperationPredicate{}) +} + +// VaultsListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c GetOperationResultClient) VaultsListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VaultOperationPredicate) (result VaultsListByResourceGroupCompleteResult, err error) { + items := make([]Vault, 0) + + resp, err := c.VaultsListByResourceGroup(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 = VaultsListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_associatedidentity.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_associatedidentity.go new file mode 100644 index 00000000000..97aa7f8c6b0 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_associatedidentity.go @@ -0,0 +1,9 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociatedIdentity struct { + OperationIdentityType *IdentityType `json:"operationIdentityType,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_azuremonitoralertsettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_azuremonitoralertsettings.go new file mode 100644 index 00000000000..142e81caaf7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_azuremonitoralertsettings.go @@ -0,0 +1,10 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureMonitorAlertSettings struct { + AlertsForAllFailoverIssues *AlertsState `json:"alertsForAllFailoverIssues,omitempty"` + AlertsForAllJobFailures *AlertsState `json:"alertsForAllJobFailures,omitempty"` + AlertsForAllReplicationIssues *AlertsState `json:"alertsForAllReplicationIssues,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_classicalertsettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_classicalertsettings.go new file mode 100644 index 00000000000..b151d865880 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_classicalertsettings.go @@ -0,0 +1,9 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClassicAlertSettings struct { + AlertsForCriticalOperations *AlertsState `json:"alertsForCriticalOperations,omitempty"` + EmailNotificationsForSiteRecovery *AlertsState `json:"emailNotificationsForSiteRecovery,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_cmkkekidentity.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_cmkkekidentity.go new file mode 100644 index 00000000000..5abe4e020ab --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_cmkkekidentity.go @@ -0,0 +1,9 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKekIdentity struct { + UseSystemAssignedIdentity *bool `json:"useSystemAssignedIdentity,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_cmkkeyvaultproperties.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_cmkkeyvaultproperties.go new file mode 100644 index 00000000000..c6d960008dd --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_cmkkeyvaultproperties.go @@ -0,0 +1,8 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKeyVaultProperties struct { + KeyUri *string `json:"keyUri,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_crosssubscriptionrestoresettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_crosssubscriptionrestoresettings.go new file mode 100644 index 00000000000..9564f280764 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_crosssubscriptionrestoresettings.go @@ -0,0 +1,8 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CrossSubscriptionRestoreSettings struct { + CrossSubscriptionRestoreState *CrossSubscriptionRestoreState `json:"crossSubscriptionRestoreState,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_immutabilitysettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_immutabilitysettings.go new file mode 100644 index 00000000000..fd103b2f150 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_immutabilitysettings.go @@ -0,0 +1,8 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImmutabilitySettings struct { + State *ImmutabilityState `json:"state,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_monitoringsettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_monitoringsettings.go new file mode 100644 index 00000000000..f53dbf44f8d --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_monitoringsettings.go @@ -0,0 +1,9 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettings struct { + AzureMonitorAlertSettings *AzureMonitorAlertSettings `json:"azureMonitorAlertSettings,omitempty"` + ClassicAlertSettings *ClassicAlertSettings `json:"classicAlertSettings,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpoint.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpoint.go new file mode 100644 index 00000000000..0d9f335b1f6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpoint.go @@ -0,0 +1,8 @@ +package getoperationresult + +// 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/recoveryservices/2025-08-01/getoperationresult/model_privateendpointconnection.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpointconnection.go new file mode 100644 index 00000000000..0e87d2c16fd --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package getoperationresult + +// 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 { + GroupIds *[]VaultSubResourceType `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpointconnectionvaultproperties.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpointconnectionvaultproperties.go new file mode 100644 index 00000000000..ed8e9151d0f --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privateendpointconnectionvaultproperties.go @@ -0,0 +1,12 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionVaultProperties struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnection `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privatelinkserviceconnectionstate.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..02db2358a45 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package getoperationresult + +// 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 *PrivateEndpointConnectionStatus `json:"status,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_restoresettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_restoresettings.go new file mode 100644 index 00000000000..d780546967e --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_restoresettings.go @@ -0,0 +1,8 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreSettings struct { + CrossSubscriptionRestoreSettings *CrossSubscriptionRestoreSettings `json:"crossSubscriptionRestoreSettings,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_securitysettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_securitysettings.go new file mode 100644 index 00000000000..5c47d7f1a09 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_securitysettings.go @@ -0,0 +1,11 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecuritySettings struct { + ImmutabilitySettings *ImmutabilitySettings `json:"immutabilitySettings,omitempty"` + MultiUserAuthorization *MultiUserAuthorization `json:"multiUserAuthorization,omitempty"` + SoftDeleteSettings *SoftDeleteSettings `json:"softDeleteSettings,omitempty"` + SourceScanConfiguration *SourceScanConfiguration `json:"sourceScanConfiguration,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_sku.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_sku.go new file mode 100644 index 00000000000..5755fa2274c --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_sku.go @@ -0,0 +1,12 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *string `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name SkuName `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_softdeletesettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_softdeletesettings.go new file mode 100644 index 00000000000..ad86cd7e560 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_softdeletesettings.go @@ -0,0 +1,10 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SoftDeleteSettings struct { + EnhancedSecurityState *EnhancedSecurityState `json:"enhancedSecurityState,omitempty"` + SoftDeleteRetentionPeriodInDays *int64 `json:"softDeleteRetentionPeriodInDays,omitempty"` + SoftDeleteState *SoftDeleteState `json:"softDeleteState,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_sourcescanconfiguration.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_sourcescanconfiguration.go new file mode 100644 index 00000000000..dfd6641b785 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_sourcescanconfiguration.go @@ -0,0 +1,9 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SourceScanConfiguration struct { + SourceScanIdentity *AssociatedIdentity `json:"sourceScanIdentity,omitempty"` + State *State `json:"state,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_upgradedetails.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_upgradedetails.go new file mode 100644 index 00000000000..40dbef97c88 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_upgradedetails.go @@ -0,0 +1,58 @@ +package getoperationresult + +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 UpgradeDetails struct { + EndTimeUtc *string `json:"endTimeUtc,omitempty"` + LastUpdatedTimeUtc *string `json:"lastUpdatedTimeUtc,omitempty"` + Message *string `json:"message,omitempty"` + OperationId *string `json:"operationId,omitempty"` + PreviousResourceId *string `json:"previousResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + Status *VaultUpgradeState `json:"status,omitempty"` + TriggerType *TriggerType `json:"triggerType,omitempty"` + UpgradedResourceId *string `json:"upgradedResourceId,omitempty"` +} + +func (o *UpgradeDetails) GetEndTimeUtcAsTime() (*time.Time, error) { + if o.EndTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetEndTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetLastUpdatedTimeUtcAsTime() (*time.Time, error) { + if o.LastUpdatedTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetLastUpdatedTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vault.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vault.go new file mode 100644 index 00000000000..b785b04779d --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vault.go @@ -0,0 +1,22 @@ +package getoperationresult + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 Vault struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultproperties.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultproperties.go new file mode 100644 index 00000000000..0404ee299bf --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultproperties.go @@ -0,0 +1,24 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultProperties struct { + BackupStorageVersion *BackupStorageVersion `json:"backupStorageVersion,omitempty"` + BcdrSecurityLevel *BCDRSecurityLevel `json:"bcdrSecurityLevel,omitempty"` + Encryption *VaultPropertiesEncryption `json:"encryption,omitempty"` + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` + MoveDetails *VaultPropertiesMoveDetails `json:"moveDetails,omitempty"` + MoveState *ResourceMoveState `json:"moveState,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnectionVaultProperties `json:"privateEndpointConnections,omitempty"` + PrivateEndpointStateForBackup *VaultPrivateEndpointState `json:"privateEndpointStateForBackup,omitempty"` + PrivateEndpointStateForSiteRecovery *VaultPrivateEndpointState `json:"privateEndpointStateForSiteRecovery,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RedundancySettings *VaultPropertiesRedundancySettings `json:"redundancySettings,omitempty"` + ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` + RestoreSettings *RestoreSettings `json:"restoreSettings,omitempty"` + SecureScore *SecureScoreLevel `json:"secureScore,omitempty"` + SecuritySettings *SecuritySettings `json:"securitySettings,omitempty"` + UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesencryption.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesencryption.go new file mode 100644 index 00000000000..b8226d9bc13 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesencryption.go @@ -0,0 +1,10 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesEncryption struct { + InfrastructureEncryption *InfrastructureEncryptionState `json:"infrastructureEncryption,omitempty"` + KekIdentity *CmkKekIdentity `json:"kekIdentity,omitempty"` + KeyVaultProperties *CmkKeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesmovedetails.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesmovedetails.go new file mode 100644 index 00000000000..77a630d368a --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesmovedetails.go @@ -0,0 +1,42 @@ +package getoperationresult + +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 VaultPropertiesMoveDetails struct { + CompletionTimeUtc *string `json:"completionTimeUtc,omitempty"` + OperationId *string `json:"operationId,omitempty"` + SourceResourceId *string `json:"sourceResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` +} + +func (o *VaultPropertiesMoveDetails) GetCompletionTimeUtcAsTime() (*time.Time, error) { + if o.CompletionTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CompletionTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetCompletionTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CompletionTimeUtc = &formatted +} + +func (o *VaultPropertiesMoveDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesredundancysettings.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesredundancysettings.go new file mode 100644 index 00000000000..407f6fe8126 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/model_vaultpropertiesredundancysettings.go @@ -0,0 +1,9 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesRedundancySettings struct { + CrossRegionRestore *CrossRegionRestore `json:"crossRegionRestore,omitempty"` + StandardTierStorageRedundancy *StandardTierStorageRedundancy `json:"standardTierStorageRedundancy,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/getoperationresult/predicates.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/predicates.go new file mode 100644 index 00000000000..687da737349 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/predicates.go @@ -0,0 +1,37 @@ +package getoperationresult + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VaultOperationPredicate) Matches(input Vault) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + 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 +} diff --git a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_erroradditionalinfo.go b/resource-manager/recoveryservices/2025-08-01/getoperationresult/version.go similarity index 50% rename from resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_erroradditionalinfo.go rename to resource-manager/recoveryservices/2025-08-01/getoperationresult/version.go index f35071cbfae..bd59a55a5aa 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_erroradditionalinfo.go +++ b/resource-manager/recoveryservices/2025-08-01/getoperationresult/version.go @@ -1,9 +1,10 @@ -package backupprotectableitems +package getoperationresult // 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"` +const defaultApiVersion = "2025-08-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/getoperationresult/2025-08-01" } diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/README.md b/resource-manager/recoveryservices/2025-08-01/openapis/README.md new file mode 100644 index 00000000000..737602e854d --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/README.md @@ -0,0 +1,62 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/openapis` Documentation + +The `openapis` SDK allows for interaction with Azure Resource Manager `recoveryservices` (API Version `2025-08-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/recoveryservices/2025-08-01/openapis" +``` + + +### Client Initialization + +```go +client := openapis.NewOpenapisClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `OpenapisClient.RecoveryServicesCapabilities` + +```go +ctx := context.TODO() +id := openapis.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := openapis.ResourceCapabilities{ + // ... +} + + +read, err := client.RecoveryServicesCapabilities(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `OpenapisClient.RecoveryServicesCheckNameAvailability` + +```go +ctx := context.TODO() +id := openapis.NewProviderLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "locationName") + +payload := openapis.CheckNameAvailabilityParameters{ + // ... +} + + +read, err := client.RecoveryServicesCheckNameAvailability(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/recoveryservices/2025-08-01/openapis/client.go b/resource-manager/recoveryservices/2025-08-01/openapis/client.go new file mode 100644 index 00000000000..497a88776d1 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/client.go @@ -0,0 +1,26 @@ +package openapis + +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 OpenapisClient struct { + Client *resourcemanager.Client +} + +func NewOpenapisClientWithBaseURI(sdkApi sdkEnv.Api) (*OpenapisClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "openapis", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating OpenapisClient: %+v", err) + } + + return &OpenapisClient{ + Client: client, + }, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/constants.go b/resource-manager/recoveryservices/2025-08-01/openapis/constants.go new file mode 100644 index 00000000000..27045c5beb9 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/constants.go @@ -0,0 +1,54 @@ +package openapis + +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 VaultSubResourceType string + +const ( + VaultSubResourceTypeAzureBackup VaultSubResourceType = "AzureBackup" + VaultSubResourceTypeAzureBackupSecondary VaultSubResourceType = "AzureBackup_secondary" + VaultSubResourceTypeAzureSiteRecovery VaultSubResourceType = "AzureSiteRecovery" +) + +func PossibleValuesForVaultSubResourceType() []string { + return []string{ + string(VaultSubResourceTypeAzureBackup), + string(VaultSubResourceTypeAzureBackupSecondary), + string(VaultSubResourceTypeAzureSiteRecovery), + } +} + +func (s *VaultSubResourceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVaultSubResourceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVaultSubResourceType(input string) (*VaultSubResourceType, error) { + vals := map[string]VaultSubResourceType{ + "azurebackup": VaultSubResourceTypeAzureBackup, + "azurebackup_secondary": VaultSubResourceTypeAzureBackupSecondary, + "azuresiterecovery": VaultSubResourceTypeAzureSiteRecovery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultSubResourceType(input) + return &out, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/id_location.go b/resource-manager/recoveryservices/2025-08-01/openapis/id_location.go new file mode 100644 index 00000000000..30bd15f4707 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/id_location.go @@ -0,0 +1,121 @@ +package openapis + +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.RecoveryServices/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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + 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/recoveryservices/2025-08-01/openapis/id_location_test.go b/resource-manager/recoveryservices/2025-08-01/openapis/id_location_test.go new file mode 100644 index 00000000000..d50868db709 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/id_location_test.go @@ -0,0 +1,237 @@ +package openapis + +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.RecoveryServices/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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/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.RecoveryServices/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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.RecoveryServices/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.RecoveryServices/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/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.rEcOvErYsErViCeS/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/recoveryservices/2025-08-01/openapis/id_providerlocation.go b/resource-manager/recoveryservices/2025-08-01/openapis/id_providerlocation.go new file mode 100644 index 00000000000..1b264be5568 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/id_providerlocation.go @@ -0,0 +1,130 @@ +package openapis + +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(&ProviderLocationId{}) +} + +var _ resourceids.ResourceId = &ProviderLocationId{} + +// ProviderLocationId is a struct representing the Resource ID for a Provider Location +type ProviderLocationId struct { + SubscriptionId string + ResourceGroupName string + LocationName string +} + +// NewProviderLocationID returns a new ProviderLocationId struct +func NewProviderLocationID(subscriptionId string, resourceGroupName string, locationName string) ProviderLocationId { + return ProviderLocationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + LocationName: locationName, + } +} + +// ParseProviderLocationID parses 'input' into a ProviderLocationId +func ParseProviderLocationID(input string) (*ProviderLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderLocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderLocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProviderLocationIDInsensitively parses 'input' case-insensitively into a ProviderLocationId +// note: this method should only be used for API response data and not user input +func ParseProviderLocationIDInsensitively(input string) (*ProviderLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProviderLocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProviderLocationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProviderLocationId) 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.LocationName, ok = input.Parsed["locationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) + } + + return nil +} + +// ValidateProviderLocationID checks that 'input' can be parsed as a Provider Location ID +func ValidateProviderLocationID(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 := ParseProviderLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Provider Location ID +func (id ProviderLocationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/locations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.LocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Provider Location ID +func (id ProviderLocationId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// String returns a human-readable description of this Provider Location ID +func (id ProviderLocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Location Name: %q", id.LocationName), + } + return fmt.Sprintf("Provider Location (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/id_providerlocation_test.go b/resource-manager/recoveryservices/2025-08-01/openapis/id_providerlocation_test.go new file mode 100644 index 00000000000..ae7d4020ea6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/id_providerlocation_test.go @@ -0,0 +1,282 @@ +package openapis + +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 = &ProviderLocationId{} + +func TestNewProviderLocationID(t *testing.T) { + id := NewProviderLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "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.ResourceGroupName != "example-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") + } + + if id.LocationName != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatProviderLocationID(t *testing.T) { + actual := NewProviderLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/locations/locationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseProviderLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProviderLocationId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/locations/locationName", + Expected: &ProviderLocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/locations/locationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProviderLocationID(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.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestParseProviderLocationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProviderLocationId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/locations/locationName", + Expected: &ProviderLocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &ProviderLocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // 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.rEcOvErYsErViCeS/lOcAtIoNs/lOcAtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProviderLocationIDInsensitively(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.LocationName != v.Expected.LocationName { + t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) + } + + } +} + +func TestSegmentsForProviderLocationId(t *testing.T) { + segments := ProviderLocationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ProviderLocationId 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/recoveryservices/2025-08-01/openapis/method_recoveryservicescapabilities.go b/resource-manager/recoveryservices/2025-08-01/openapis/method_recoveryservicescapabilities.go new file mode 100644 index 00000000000..e1fb0c854d7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/method_recoveryservicescapabilities.go @@ -0,0 +1,58 @@ +package openapis + +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 RecoveryServicesCapabilitiesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapabilitiesResponse +} + +// RecoveryServicesCapabilities ... +func (c OpenapisClient) RecoveryServicesCapabilities(ctx context.Context, id LocationId, input ResourceCapabilities) (result RecoveryServicesCapabilitiesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/capabilities", 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 CapabilitiesResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/method_recoveryserviceschecknameavailability.go b/resource-manager/recoveryservices/2025-08-01/openapis/method_recoveryserviceschecknameavailability.go new file mode 100644 index 00000000000..0e283aadcd3 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/method_recoveryserviceschecknameavailability.go @@ -0,0 +1,58 @@ +package openapis + +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 RecoveryServicesCheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameAvailabilityResult +} + +// RecoveryServicesCheckNameAvailability ... +func (c OpenapisClient) RecoveryServicesCheckNameAvailability(ctx context.Context, id ProviderLocationId, input CheckNameAvailabilityParameters) (result RecoveryServicesCheckNameAvailabilityOperationResponse, 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 CheckNameAvailabilityResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesproperties.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesproperties.go new file mode 100644 index 00000000000..25b50446c96 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesproperties.go @@ -0,0 +1,8 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilitiesProperties struct { + DnsZones *[]DNSZone `json:"dnsZones,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesresponse.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesresponse.go new file mode 100644 index 00000000000..84e6b824945 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesresponse.go @@ -0,0 +1,9 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilitiesResponse struct { + Properties *CapabilitiesResponseProperties `json:"properties,omitempty"` + Type string `json:"type"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesresponseproperties.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesresponseproperties.go new file mode 100644 index 00000000000..628ccce10fe --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_capabilitiesresponseproperties.go @@ -0,0 +1,8 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapabilitiesResponseProperties struct { + DnsZones *[]DNSZoneResponse `json:"dnsZones,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_checknameavailabilityparameters.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_checknameavailabilityparameters.go new file mode 100644 index 00000000000..a52565a7498 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_checknameavailabilityparameters.go @@ -0,0 +1,9 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityParameters struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_checknameavailabilityresult.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..bf667073d60 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *string `json:"reason,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_dnszone.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_dnszone.go new file mode 100644 index 00000000000..4ca7d180e19 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_dnszone.go @@ -0,0 +1,8 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DNSZone struct { + SubResource *VaultSubResourceType `json:"subResource,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_dnszoneresponse.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_dnszoneresponse.go new file mode 100644 index 00000000000..cbbf43f3fa6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_dnszoneresponse.go @@ -0,0 +1,9 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DNSZoneResponse struct { + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` + SubResource *VaultSubResourceType `json:"subResource,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/model_resourcecapabilities.go b/resource-manager/recoveryservices/2025-08-01/openapis/model_resourcecapabilities.go new file mode 100644 index 00000000000..501e1569030 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/model_resourcecapabilities.go @@ -0,0 +1,9 @@ +package openapis + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceCapabilities struct { + Properties *CapabilitiesProperties `json:"properties,omitempty"` + Type string `json:"type"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/openapis/version.go b/resource-manager/recoveryservices/2025-08-01/openapis/version.go new file mode 100644 index 00000000000..bf71efb49eb --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/openapis/version.go @@ -0,0 +1,10 @@ +package openapis + +// 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-08-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/openapis/2025-08-01" +} diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/README.md b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/README.md new file mode 100644 index 00000000000..c3262596ba2 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup` Documentation + +The `privatelinkresourceoperationgroup` SDK allows for interaction with Azure Resource Manager `recoveryservices` (API Version `2025-08-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/recoveryservices/2025-08-01/privatelinkresourceoperationgroup" +``` + + +### Client Initialization + +```go +client := privatelinkresourceoperationgroup.NewPrivateLinkResourceOperationGroupClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateLinkResourceOperationGroupClient.PrivateLinkResourcesGet` + +```go +ctx := context.TODO() +id := privatelinkresourceoperationgroup.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateLinkResourceName") + +read, err := client.PrivateLinkResourcesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `PrivateLinkResourceOperationGroupClient.PrivateLinkResourcesList` + +```go +ctx := context.TODO() +id := privatelinkresourceoperationgroup.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.PrivateLinkResourcesList(ctx, id)` can be used to do batched pagination +items, err := client.PrivateLinkResourcesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/client.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/client.go new file mode 100644 index 00000000000..349f98dbdd6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/client.go @@ -0,0 +1,26 @@ +package privatelinkresourceoperationgroup + +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 PrivateLinkResourceOperationGroupClient struct { + Client *resourcemanager.Client +} + +func NewPrivateLinkResourceOperationGroupClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateLinkResourceOperationGroupClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "privatelinkresourceoperationgroup", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateLinkResourceOperationGroupClient: %+v", err) + } + + return &PrivateLinkResourceOperationGroupClient{ + Client: client, + }, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_privatelinkresource.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_privatelinkresource.go new file mode 100644 index 00000000000..bc6e96b4aef --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_privatelinkresource.go @@ -0,0 +1,139 @@ +package privatelinkresourceoperationgroup + +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(&PrivateLinkResourceId{}) +} + +var _ resourceids.ResourceId = &PrivateLinkResourceId{} + +// PrivateLinkResourceId is a struct representing the Resource ID for a Private Link Resource +type PrivateLinkResourceId struct { + SubscriptionId string + ResourceGroupName string + VaultName string + PrivateLinkResourceName string +} + +// NewPrivateLinkResourceID returns a new PrivateLinkResourceId struct +func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, vaultName string, privateLinkResourceName string) PrivateLinkResourceId { + return PrivateLinkResourceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + PrivateLinkResourceName: privateLinkResourceName, + } +} + +// ParsePrivateLinkResourceID parses 'input' into a PrivateLinkResourceId +func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateLinkResourceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateLinkResourceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateLinkResourceIDInsensitively parses 'input' case-insensitively into a PrivateLinkResourceId +// note: this method should only be used for API response data and not user input +func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateLinkResourceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateLinkResourceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) 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.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) + } + + if id.PrivateLinkResourceName, ok = input.Parsed["privateLinkResourceName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateLinkResourceName", input) + } + + return nil +} + +// ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID +func ValidatePrivateLinkResourceID(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 := ParsePrivateLinkResourceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Link Resource ID +func (id PrivateLinkResourceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/privateLinkResources/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.PrivateLinkResourceName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Link Resource ID +func (id PrivateLinkResourceId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + resourceids.StaticSegment("staticPrivateLinkResources", "privateLinkResources", "privateLinkResources"), + resourceids.UserSpecifiedSegment("privateLinkResourceName", "privateLinkResourceName"), + } +} + +// String returns a human-readable description of this Private Link Resource ID +func (id PrivateLinkResourceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Private Link Resource Name: %q", id.PrivateLinkResourceName), + } + return fmt.Sprintf("Private Link Resource (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_privatelinkresource_test.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_privatelinkresource_test.go new file mode 100644 index 00000000000..46d9666c584 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_privatelinkresource_test.go @@ -0,0 +1,327 @@ +package privatelinkresourceoperationgroup + +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 = &PrivateLinkResourceId{} + +func TestNewPrivateLinkResourceID(t *testing.T) { + id := NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateLinkResourceName") + + 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.VaultName != "vaultName" { + t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + } + + if id.PrivateLinkResourceName != "privateLinkResourceName" { + t.Fatalf("Expected %q but got %q for Segment 'PrivateLinkResourceName'", id.PrivateLinkResourceName, "privateLinkResourceName") + } +} + +func TestFormatPrivateLinkResourceID(t *testing.T) { + actual := NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "privateLinkResourceName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/privateLinkResources/privateLinkResourceName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateLinkResourceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateLinkResourceId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/privateLinkResources", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/privateLinkResources/privateLinkResourceName", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + PrivateLinkResourceName: "privateLinkResourceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/privateLinkResources/privateLinkResourceName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateLinkResourceID(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + if actual.PrivateLinkResourceName != v.Expected.PrivateLinkResourceName { + t.Fatalf("Expected %q but got %q for PrivateLinkResourceName", v.Expected.PrivateLinkResourceName, actual.PrivateLinkResourceName) + } + + } +} + +func TestParsePrivateLinkResourceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateLinkResourceId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/privateLinkResources", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/pRiVaTeLiNkReSoUrCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/privateLinkResources/privateLinkResourceName", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + PrivateLinkResourceName: "privateLinkResourceName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/privateLinkResources/privateLinkResourceName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/pRiVaTeLiNkReSoUrCeS/pRiVaTeLiNkReSoUrCeNaMe", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VaultName: "vAuLtNaMe", + PrivateLinkResourceName: "pRiVaTeLiNkReSoUrCeNaMe", + }, + }, + { + // 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.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/pRiVaTeLiNkReSoUrCeS/pRiVaTeLiNkReSoUrCeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateLinkResourceIDInsensitively(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + if actual.PrivateLinkResourceName != v.Expected.PrivateLinkResourceName { + t.Fatalf("Expected %q but got %q for PrivateLinkResourceName", v.Expected.PrivateLinkResourceName, actual.PrivateLinkResourceName) + } + + } +} + +func TestSegmentsForPrivateLinkResourceId(t *testing.T) { + segments := PrivateLinkResourceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateLinkResourceId 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/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_vault.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_vault.go new file mode 100644 index 00000000000..e13df44fec3 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_vault.go @@ -0,0 +1,130 @@ +package privatelinkresourceoperationgroup + +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(&VaultId{}) +} + +var _ resourceids.ResourceId = &VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VaultId) 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.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) + } + + return nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(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 := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_vault_test.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_vault_test.go new file mode 100644 index 00000000000..8e888ff8f05 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/id_vault_test.go @@ -0,0 +1,282 @@ +package privatelinkresourceoperationgroup + +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 = &VaultId{} + +func TestNewVaultID(t *testing.T) { + id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + + 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.VaultName != "vaultName" { + t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + } +} + +func TestFormatVaultID(t *testing.T) { + actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVaultID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVaultID(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + } +} + +func TestParseVaultIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VaultName: "vAuLtNaMe", + }, + }, + { + // 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.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVaultIDInsensitively(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + } +} + +func TestSegmentsForVaultId(t *testing.T) { + segments := VaultId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VaultId 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/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/method_privatelinkresourcesget.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/method_privatelinkresourcesget.go new file mode 100644 index 00000000000..b7624c79a8f --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/method_privatelinkresourcesget.go @@ -0,0 +1,53 @@ +package privatelinkresourceoperationgroup + +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 PrivateLinkResourcesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *PrivateLinkResource +} + +// PrivateLinkResourcesGet ... +func (c PrivateLinkResourceOperationGroupClient) PrivateLinkResourcesGet(ctx context.Context, id PrivateLinkResourceId) (result PrivateLinkResourcesGetOperationResponse, 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 PrivateLinkResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/method_privatelinkresourceslist.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/method_privatelinkresourceslist.go new file mode 100644 index 00000000000..739798dd17d --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/method_privatelinkresourceslist.go @@ -0,0 +1,105 @@ +package privatelinkresourceoperationgroup + +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 PrivateLinkResourcesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PrivateLinkResource +} + +type PrivateLinkResourcesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []PrivateLinkResource +} + +type PrivateLinkResourcesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *PrivateLinkResourcesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// PrivateLinkResourcesList ... +func (c PrivateLinkResourceOperationGroupClient) PrivateLinkResourcesList(ctx context.Context, id VaultId) (result PrivateLinkResourcesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &PrivateLinkResourcesListCustomPager{}, + 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.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]PrivateLinkResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// PrivateLinkResourcesListComplete retrieves all the results into a single object +func (c PrivateLinkResourceOperationGroupClient) PrivateLinkResourcesListComplete(ctx context.Context, id VaultId) (PrivateLinkResourcesListCompleteResult, error) { + return c.PrivateLinkResourcesListCompleteMatchingPredicate(ctx, id, PrivateLinkResourceOperationPredicate{}) +} + +// PrivateLinkResourcesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateLinkResourceOperationGroupClient) PrivateLinkResourcesListCompleteMatchingPredicate(ctx context.Context, id VaultId, predicate PrivateLinkResourceOperationPredicate) (result PrivateLinkResourcesListCompleteResult, err error) { + items := make([]PrivateLinkResource, 0) + + resp, err := c.PrivateLinkResourcesList(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 = PrivateLinkResourcesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/model_privatelinkresource.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/model_privatelinkresource.go new file mode 100644 index 00000000000..d4f4b2b5c96 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/model_privatelinkresource.go @@ -0,0 +1,16 @@ +package privatelinkresourceoperationgroup + +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 PrivateLinkResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/model_privatelinkresourceproperties.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/model_privatelinkresourceproperties.go new file mode 100644 index 00000000000..27205570a18 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/model_privatelinkresourceproperties.go @@ -0,0 +1,10 @@ +package privatelinkresourceoperationgroup + +// 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/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/predicates.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/predicates.go new file mode 100644 index 00000000000..9bf418576a6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/predicates.go @@ -0,0 +1,27 @@ +package privatelinkresourceoperationgroup + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateLinkResourceOperationPredicate) Matches(input PrivateLinkResource) 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/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/version.go b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/version.go new file mode 100644 index 00000000000..7ac6fee80a1 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/privatelinkresourceoperationgroup/version.go @@ -0,0 +1,10 @@ +package privatelinkresourceoperationgroup + +// 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-08-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/privatelinkresourceoperationgroup/2025-08-01" +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/README.md b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/README.md new file mode 100644 index 00000000000..235659f5286 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/README.md @@ -0,0 +1,78 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources` Documentation + +The `vaultextendedinforesources` SDK allows for interaction with Azure Resource Manager `recoveryservices` (API Version `2025-08-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/recoveryservices/2025-08-01/vaultextendedinforesources" +``` + + +### Client Initialization + +```go +client := vaultextendedinforesources.NewVaultExtendedInfoResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VaultExtendedInfoResourcesClient.VaultExtendedInfoCreateOrUpdate` + +```go +ctx := context.TODO() +id := vaultextendedinforesources.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := vaultextendedinforesources.VaultExtendedInfoResource{ + // ... +} + + +read, err := client.VaultExtendedInfoCreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VaultExtendedInfoResourcesClient.VaultExtendedInfoGet` + +```go +ctx := context.TODO() +id := vaultextendedinforesources.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +read, err := client.VaultExtendedInfoGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VaultExtendedInfoResourcesClient.VaultExtendedInfoUpdate` + +```go +ctx := context.TODO() +id := vaultextendedinforesources.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := vaultextendedinforesources.VaultExtendedInfoResource{ + // ... +} + + +read, err := client.VaultExtendedInfoUpdate(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/recoveryservices/2025-08-01/vaultextendedinforesources/client.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/client.go new file mode 100644 index 00000000000..fdefe59bb63 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/client.go @@ -0,0 +1,26 @@ +package vaultextendedinforesources + +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 VaultExtendedInfoResourcesClient struct { + Client *resourcemanager.Client +} + +func NewVaultExtendedInfoResourcesClientWithBaseURI(sdkApi sdkEnv.Api) (*VaultExtendedInfoResourcesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "vaultextendedinforesources", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VaultExtendedInfoResourcesClient: %+v", err) + } + + return &VaultExtendedInfoResourcesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/id_vault.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/id_vault.go new file mode 100644 index 00000000000..ed34fd2cfba --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/id_vault.go @@ -0,0 +1,130 @@ +package vaultextendedinforesources + +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(&VaultId{}) +} + +var _ resourceids.ResourceId = &VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VaultId) 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.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) + } + + return nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(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 := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/id_vault_test.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/id_vault_test.go new file mode 100644 index 00000000000..9a1c2e3e022 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/id_vault_test.go @@ -0,0 +1,282 @@ +package vaultextendedinforesources + +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 = &VaultId{} + +func TestNewVaultID(t *testing.T) { + id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + + 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.VaultName != "vaultName" { + t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + } +} + +func TestFormatVaultID(t *testing.T) { + actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVaultID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVaultID(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + } +} + +func TestParseVaultIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VaultName: "vAuLtNaMe", + }, + }, + { + // 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.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVaultIDInsensitively(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + } +} + +func TestSegmentsForVaultId(t *testing.T) { + segments := VaultId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VaultId 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/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfocreateorupdate.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfocreateorupdate.go new file mode 100644 index 00000000000..1e2745c7778 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfocreateorupdate.go @@ -0,0 +1,58 @@ +package vaultextendedinforesources + +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 VaultExtendedInfoCreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VaultExtendedInfoResource +} + +// VaultExtendedInfoCreateOrUpdate ... +func (c VaultExtendedInfoResourcesClient) VaultExtendedInfoCreateOrUpdate(ctx context.Context, id VaultId, input VaultExtendedInfoResource) (result VaultExtendedInfoCreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/extendedInformation/vaultExtendedInfo", 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 VaultExtendedInfoResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfoget.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfoget.go new file mode 100644 index 00000000000..73a3b7e0949 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfoget.go @@ -0,0 +1,54 @@ +package vaultextendedinforesources + +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 VaultExtendedInfoGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VaultExtendedInfoResource +} + +// VaultExtendedInfoGet ... +func (c VaultExtendedInfoResourcesClient) VaultExtendedInfoGet(ctx context.Context, id VaultId) (result VaultExtendedInfoGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/extendedInformation/vaultExtendedInfo", 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 VaultExtendedInfoResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfoupdate.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfoupdate.go new file mode 100644 index 00000000000..ace89a73905 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/method_vaultextendedinfoupdate.go @@ -0,0 +1,58 @@ +package vaultextendedinforesources + +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 VaultExtendedInfoUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VaultExtendedInfoResource +} + +// VaultExtendedInfoUpdate ... +func (c VaultExtendedInfoResourcesClient) VaultExtendedInfoUpdate(ctx context.Context, id VaultId, input VaultExtendedInfoResource) (result VaultExtendedInfoUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/extendedInformation/vaultExtendedInfo", 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 VaultExtendedInfoResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/model_vaultextendedinfo.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/model_vaultextendedinfo.go new file mode 100644 index 00000000000..26958ee15c7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/model_vaultextendedinfo.go @@ -0,0 +1,11 @@ +package vaultextendedinforesources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultExtendedInfo struct { + Algorithm *string `json:"algorithm,omitempty"` + EncryptionKey *string `json:"encryptionKey,omitempty"` + EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` + IntegrityKey *string `json:"integrityKey,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/model_vaultextendedinforesource.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/model_vaultextendedinforesource.go new file mode 100644 index 00000000000..47ea8e56d63 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/model_vaultextendedinforesource.go @@ -0,0 +1,17 @@ +package vaultextendedinforesources + +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 VaultExtendedInfoResource struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VaultExtendedInfo `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/version.go b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/version.go new file mode 100644 index 00000000000..043a696c324 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaultextendedinforesources/version.go @@ -0,0 +1,10 @@ +package vaultextendedinforesources + +// 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-08-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/vaultextendedinforesources/2025-08-01" +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/README.md b/resource-manager/recoveryservices/2025-08-01/vaults/README.md new file mode 100644 index 00000000000..7c23825d6bc --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/README.md @@ -0,0 +1,171 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/recoveryservices/2025-08-01/vaults` Documentation + +The `vaults` SDK allows for interaction with Azure Resource Manager `recoveryservices` (API Version `2025-08-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/recoveryservices/2025-08-01/vaults" +``` + + +### Client Initialization + +```go +client := vaults.NewVaultsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VaultsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := vaults.Vault{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, vaults.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VaultsClient.Delete` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VaultsClient.Get` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +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: `VaultsClient.ListBySubscriptionId` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscriptionId(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionIdComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VaultsClient.RegisteredIdentitiesDelete` + +```go +ctx := context.TODO() +id := vaults.NewRegisteredIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "registeredIdentityName") + +read, err := client.RegisteredIdentitiesDelete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VaultsClient.ReplicationUsagesList` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.ReplicationUsagesList(ctx, id)` can be used to do batched pagination +items, err := client.ReplicationUsagesListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VaultsClient.Update` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +payload := vaults.PatchVault{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, vaults.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VaultsClient.UsagesListByVaults` + +```go +ctx := context.TODO() +id := vaults.NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + +// alternatively `client.UsagesListByVaults(ctx, id)` can be used to do batched pagination +items, err := client.UsagesListByVaultsComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VaultsClient.VaultCertificatesCreate` + +```go +ctx := context.TODO() +id := vaults.NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "certificateName") + +payload := vaults.CertificateRequest{ + // ... +} + + +read, err := client.VaultCertificatesCreate(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/recoveryservices/2025-08-01/vaults/client.go b/resource-manager/recoveryservices/2025-08-01/vaults/client.go new file mode 100644 index 00000000000..37bd7a44670 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/client.go @@ -0,0 +1,26 @@ +package vaults + +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 VaultsClient struct { + Client *resourcemanager.Client +} + +func NewVaultsClientWithBaseURI(sdkApi sdkEnv.Api) (*VaultsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "vaults", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VaultsClient: %+v", err) + } + + return &VaultsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/constants.go b/resource-manager/recoveryservices/2025-08-01/vaults/constants.go new file mode 100644 index 00000000000..d76a6f55ab3 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/constants.go @@ -0,0 +1,1146 @@ +package vaults + +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 AlertsState string + +const ( + AlertsStateDisabled AlertsState = "Disabled" + AlertsStateEnabled AlertsState = "Enabled" +) + +func PossibleValuesForAlertsState() []string { + return []string{ + string(AlertsStateDisabled), + string(AlertsStateEnabled), + } +} + +func (s *AlertsState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlertsState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAlertsState(input string) (*AlertsState, error) { + vals := map[string]AlertsState{ + "disabled": AlertsStateDisabled, + "enabled": AlertsStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlertsState(input) + return &out, nil +} + +type AuthType string + +const ( + AuthTypeAAD AuthType = "AAD" + AuthTypeACS AuthType = "ACS" + AuthTypeAccessControlService AuthType = "AccessControlService" + AuthTypeAzureActiveDirectory AuthType = "AzureActiveDirectory" + AuthTypeInvalid AuthType = "Invalid" +) + +func PossibleValuesForAuthType() []string { + return []string{ + string(AuthTypeAAD), + string(AuthTypeACS), + string(AuthTypeAccessControlService), + string(AuthTypeAzureActiveDirectory), + string(AuthTypeInvalid), + } +} + +func (s *AuthType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAuthType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAuthType(input string) (*AuthType, error) { + vals := map[string]AuthType{ + "aad": AuthTypeAAD, + "acs": AuthTypeACS, + "accesscontrolservice": AuthTypeAccessControlService, + "azureactivedirectory": AuthTypeAzureActiveDirectory, + "invalid": AuthTypeInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthType(input) + return &out, nil +} + +type BCDRSecurityLevel string + +const ( + BCDRSecurityLevelExcellent BCDRSecurityLevel = "Excellent" + BCDRSecurityLevelFair BCDRSecurityLevel = "Fair" + BCDRSecurityLevelGood BCDRSecurityLevel = "Good" + BCDRSecurityLevelPoor BCDRSecurityLevel = "Poor" +) + +func PossibleValuesForBCDRSecurityLevel() []string { + return []string{ + string(BCDRSecurityLevelExcellent), + string(BCDRSecurityLevelFair), + string(BCDRSecurityLevelGood), + string(BCDRSecurityLevelPoor), + } +} + +func (s *BCDRSecurityLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBCDRSecurityLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBCDRSecurityLevel(input string) (*BCDRSecurityLevel, error) { + vals := map[string]BCDRSecurityLevel{ + "excellent": BCDRSecurityLevelExcellent, + "fair": BCDRSecurityLevelFair, + "good": BCDRSecurityLevelGood, + "poor": BCDRSecurityLevelPoor, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BCDRSecurityLevel(input) + return &out, nil +} + +type BackupStorageVersion string + +const ( + BackupStorageVersionUnassigned BackupStorageVersion = "Unassigned" + BackupStorageVersionVOne BackupStorageVersion = "V1" + BackupStorageVersionVTwo BackupStorageVersion = "V2" +) + +func PossibleValuesForBackupStorageVersion() []string { + return []string{ + string(BackupStorageVersionUnassigned), + string(BackupStorageVersionVOne), + string(BackupStorageVersionVTwo), + } +} + +func (s *BackupStorageVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackupStorageVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBackupStorageVersion(input string) (*BackupStorageVersion, error) { + vals := map[string]BackupStorageVersion{ + "unassigned": BackupStorageVersionUnassigned, + "v1": BackupStorageVersionVOne, + "v2": BackupStorageVersionVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackupStorageVersion(input) + return &out, nil +} + +type CrossRegionRestore string + +const ( + CrossRegionRestoreDisabled CrossRegionRestore = "Disabled" + CrossRegionRestoreEnabled CrossRegionRestore = "Enabled" +) + +func PossibleValuesForCrossRegionRestore() []string { + return []string{ + string(CrossRegionRestoreDisabled), + string(CrossRegionRestoreEnabled), + } +} + +func (s *CrossRegionRestore) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCrossRegionRestore(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCrossRegionRestore(input string) (*CrossRegionRestore, error) { + vals := map[string]CrossRegionRestore{ + "disabled": CrossRegionRestoreDisabled, + "enabled": CrossRegionRestoreEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CrossRegionRestore(input) + return &out, nil +} + +type CrossSubscriptionRestoreState string + +const ( + CrossSubscriptionRestoreStateDisabled CrossSubscriptionRestoreState = "Disabled" + CrossSubscriptionRestoreStateEnabled CrossSubscriptionRestoreState = "Enabled" + CrossSubscriptionRestoreStatePermanentlyDisabled CrossSubscriptionRestoreState = "PermanentlyDisabled" +) + +func PossibleValuesForCrossSubscriptionRestoreState() []string { + return []string{ + string(CrossSubscriptionRestoreStateDisabled), + string(CrossSubscriptionRestoreStateEnabled), + string(CrossSubscriptionRestoreStatePermanentlyDisabled), + } +} + +func (s *CrossSubscriptionRestoreState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCrossSubscriptionRestoreState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCrossSubscriptionRestoreState(input string) (*CrossSubscriptionRestoreState, error) { + vals := map[string]CrossSubscriptionRestoreState{ + "disabled": CrossSubscriptionRestoreStateDisabled, + "enabled": CrossSubscriptionRestoreStateEnabled, + "permanentlydisabled": CrossSubscriptionRestoreStatePermanentlyDisabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CrossSubscriptionRestoreState(input) + return &out, nil +} + +type EnhancedSecurityState string + +const ( + EnhancedSecurityStateAlwaysON EnhancedSecurityState = "AlwaysON" + EnhancedSecurityStateDisabled EnhancedSecurityState = "Disabled" + EnhancedSecurityStateEnabled EnhancedSecurityState = "Enabled" + EnhancedSecurityStateInvalid EnhancedSecurityState = "Invalid" +) + +func PossibleValuesForEnhancedSecurityState() []string { + return []string{ + string(EnhancedSecurityStateAlwaysON), + string(EnhancedSecurityStateDisabled), + string(EnhancedSecurityStateEnabled), + string(EnhancedSecurityStateInvalid), + } +} + +func (s *EnhancedSecurityState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseEnhancedSecurityState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseEnhancedSecurityState(input string) (*EnhancedSecurityState, error) { + vals := map[string]EnhancedSecurityState{ + "alwayson": EnhancedSecurityStateAlwaysON, + "disabled": EnhancedSecurityStateDisabled, + "enabled": EnhancedSecurityStateEnabled, + "invalid": EnhancedSecurityStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnhancedSecurityState(input) + return &out, nil +} + +type IdentityType string + +const ( + IdentityTypeSystemAssigned IdentityType = "SystemAssigned" + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +func PossibleValuesForIdentityType() []string { + return []string{ + string(IdentityTypeSystemAssigned), + string(IdentityTypeUserAssigned), + } +} + +func (s *IdentityType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIdentityType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIdentityType(input string) (*IdentityType, error) { + vals := map[string]IdentityType{ + "systemassigned": IdentityTypeSystemAssigned, + "userassigned": IdentityTypeUserAssigned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IdentityType(input) + return &out, nil +} + +type ImmutabilityState string + +const ( + ImmutabilityStateDisabled ImmutabilityState = "Disabled" + ImmutabilityStateLocked ImmutabilityState = "Locked" + ImmutabilityStateUnlocked ImmutabilityState = "Unlocked" +) + +func PossibleValuesForImmutabilityState() []string { + return []string{ + string(ImmutabilityStateDisabled), + string(ImmutabilityStateLocked), + string(ImmutabilityStateUnlocked), + } +} + +func (s *ImmutabilityState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseImmutabilityState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseImmutabilityState(input string) (*ImmutabilityState, error) { + vals := map[string]ImmutabilityState{ + "disabled": ImmutabilityStateDisabled, + "locked": ImmutabilityStateLocked, + "unlocked": ImmutabilityStateUnlocked, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ImmutabilityState(input) + return &out, nil +} + +type InfrastructureEncryptionState string + +const ( + InfrastructureEncryptionStateDisabled InfrastructureEncryptionState = "Disabled" + InfrastructureEncryptionStateEnabled InfrastructureEncryptionState = "Enabled" +) + +func PossibleValuesForInfrastructureEncryptionState() []string { + return []string{ + string(InfrastructureEncryptionStateDisabled), + string(InfrastructureEncryptionStateEnabled), + } +} + +func (s *InfrastructureEncryptionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInfrastructureEncryptionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInfrastructureEncryptionState(input string) (*InfrastructureEncryptionState, error) { + vals := map[string]InfrastructureEncryptionState{ + "disabled": InfrastructureEncryptionStateDisabled, + "enabled": InfrastructureEncryptionStateEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InfrastructureEncryptionState(input) + return &out, nil +} + +type MultiUserAuthorization string + +const ( + MultiUserAuthorizationDisabled MultiUserAuthorization = "Disabled" + MultiUserAuthorizationEnabled MultiUserAuthorization = "Enabled" + MultiUserAuthorizationInvalid MultiUserAuthorization = "Invalid" +) + +func PossibleValuesForMultiUserAuthorization() []string { + return []string{ + string(MultiUserAuthorizationDisabled), + string(MultiUserAuthorizationEnabled), + string(MultiUserAuthorizationInvalid), + } +} + +func (s *MultiUserAuthorization) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMultiUserAuthorization(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMultiUserAuthorization(input string) (*MultiUserAuthorization, error) { + vals := map[string]MultiUserAuthorization{ + "disabled": MultiUserAuthorizationDisabled, + "enabled": MultiUserAuthorizationEnabled, + "invalid": MultiUserAuthorizationInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MultiUserAuthorization(input) + return &out, nil +} + +type PrivateEndpointConnectionStatus string + +const ( + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointConnectionStatus() []string { + return []string{ + string(PrivateEndpointConnectionStatusApproved), + string(PrivateEndpointConnectionStatusDisconnected), + string(PrivateEndpointConnectionStatusPending), + string(PrivateEndpointConnectionStatusRejected), + } +} + +func (s *PrivateEndpointConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionStatus(input string) (*PrivateEndpointConnectionStatus, error) { + vals := map[string]PrivateEndpointConnectionStatus{ + "approved": PrivateEndpointConnectionStatusApproved, + "disconnected": PrivateEndpointConnectionStatusDisconnected, + "pending": PrivateEndpointConnectionStatusPending, + "rejected": PrivateEndpointConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStatePending ProvisioningState = "Pending" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStatePending), + string(ProvisioningStateSucceeded), + } +} + +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{ + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "pending": ProvisioningStatePending, + "succeeded": ProvisioningStateSucceeded, + } + 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 ResourceMoveState string + +const ( + ResourceMoveStateCommitFailed ResourceMoveState = "CommitFailed" + ResourceMoveStateCommitTimedout ResourceMoveState = "CommitTimedout" + ResourceMoveStateCriticalFailure ResourceMoveState = "CriticalFailure" + ResourceMoveStateFailure ResourceMoveState = "Failure" + ResourceMoveStateInProgress ResourceMoveState = "InProgress" + ResourceMoveStateMoveSucceeded ResourceMoveState = "MoveSucceeded" + ResourceMoveStatePartialSuccess ResourceMoveState = "PartialSuccess" + ResourceMoveStatePrepareFailed ResourceMoveState = "PrepareFailed" + ResourceMoveStatePrepareTimedout ResourceMoveState = "PrepareTimedout" + ResourceMoveStateUnknown ResourceMoveState = "Unknown" +) + +func PossibleValuesForResourceMoveState() []string { + return []string{ + string(ResourceMoveStateCommitFailed), + string(ResourceMoveStateCommitTimedout), + string(ResourceMoveStateCriticalFailure), + string(ResourceMoveStateFailure), + string(ResourceMoveStateInProgress), + string(ResourceMoveStateMoveSucceeded), + string(ResourceMoveStatePartialSuccess), + string(ResourceMoveStatePrepareFailed), + string(ResourceMoveStatePrepareTimedout), + string(ResourceMoveStateUnknown), + } +} + +func (s *ResourceMoveState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceMoveState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceMoveState(input string) (*ResourceMoveState, error) { + vals := map[string]ResourceMoveState{ + "commitfailed": ResourceMoveStateCommitFailed, + "committimedout": ResourceMoveStateCommitTimedout, + "criticalfailure": ResourceMoveStateCriticalFailure, + "failure": ResourceMoveStateFailure, + "inprogress": ResourceMoveStateInProgress, + "movesucceeded": ResourceMoveStateMoveSucceeded, + "partialsuccess": ResourceMoveStatePartialSuccess, + "preparefailed": ResourceMoveStatePrepareFailed, + "preparetimedout": ResourceMoveStatePrepareTimedout, + "unknown": ResourceMoveStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceMoveState(input) + return &out, nil +} + +type SecureScoreLevel string + +const ( + SecureScoreLevelAdequate SecureScoreLevel = "Adequate" + SecureScoreLevelMaximum SecureScoreLevel = "Maximum" + SecureScoreLevelMinimum SecureScoreLevel = "Minimum" + SecureScoreLevelNone SecureScoreLevel = "None" +) + +func PossibleValuesForSecureScoreLevel() []string { + return []string{ + string(SecureScoreLevelAdequate), + string(SecureScoreLevelMaximum), + string(SecureScoreLevelMinimum), + string(SecureScoreLevelNone), + } +} + +func (s *SecureScoreLevel) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecureScoreLevel(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecureScoreLevel(input string) (*SecureScoreLevel, error) { + vals := map[string]SecureScoreLevel{ + "adequate": SecureScoreLevelAdequate, + "maximum": SecureScoreLevelMaximum, + "minimum": SecureScoreLevelMinimum, + "none": SecureScoreLevelNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecureScoreLevel(input) + return &out, nil +} + +type SkuName string + +const ( + SkuNameRSZero SkuName = "RS0" + SkuNameStandard SkuName = "Standard" +) + +func PossibleValuesForSkuName() []string { + return []string{ + string(SkuNameRSZero), + string(SkuNameStandard), + } +} + +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{ + "rs0": SkuNameRSZero, + "standard": SkuNameStandard, + } + 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 SoftDeleteState string + +const ( + SoftDeleteStateAlwaysON SoftDeleteState = "AlwaysON" + SoftDeleteStateDisabled SoftDeleteState = "Disabled" + SoftDeleteStateEnabled SoftDeleteState = "Enabled" + SoftDeleteStateInvalid SoftDeleteState = "Invalid" +) + +func PossibleValuesForSoftDeleteState() []string { + return []string{ + string(SoftDeleteStateAlwaysON), + string(SoftDeleteStateDisabled), + string(SoftDeleteStateEnabled), + string(SoftDeleteStateInvalid), + } +} + +func (s *SoftDeleteState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSoftDeleteState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSoftDeleteState(input string) (*SoftDeleteState, error) { + vals := map[string]SoftDeleteState{ + "alwayson": SoftDeleteStateAlwaysON, + "disabled": SoftDeleteStateDisabled, + "enabled": SoftDeleteStateEnabled, + "invalid": SoftDeleteStateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SoftDeleteState(input) + return &out, nil +} + +type StandardTierStorageRedundancy string + +const ( + StandardTierStorageRedundancyGeoRedundant StandardTierStorageRedundancy = "GeoRedundant" + StandardTierStorageRedundancyInvalid StandardTierStorageRedundancy = "Invalid" + StandardTierStorageRedundancyLocallyRedundant StandardTierStorageRedundancy = "LocallyRedundant" + StandardTierStorageRedundancyZoneRedundant StandardTierStorageRedundancy = "ZoneRedundant" +) + +func PossibleValuesForStandardTierStorageRedundancy() []string { + return []string{ + string(StandardTierStorageRedundancyGeoRedundant), + string(StandardTierStorageRedundancyInvalid), + string(StandardTierStorageRedundancyLocallyRedundant), + string(StandardTierStorageRedundancyZoneRedundant), + } +} + +func (s *StandardTierStorageRedundancy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStandardTierStorageRedundancy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStandardTierStorageRedundancy(input string) (*StandardTierStorageRedundancy, error) { + vals := map[string]StandardTierStorageRedundancy{ + "georedundant": StandardTierStorageRedundancyGeoRedundant, + "invalid": StandardTierStorageRedundancyInvalid, + "locallyredundant": StandardTierStorageRedundancyLocallyRedundant, + "zoneredundant": StandardTierStorageRedundancyZoneRedundant, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StandardTierStorageRedundancy(input) + return &out, nil +} + +type State string + +const ( + StateDisabled State = "Disabled" + StateEnabled State = "Enabled" + StateInvalid State = "Invalid" +) + +func PossibleValuesForState() []string { + return []string{ + string(StateDisabled), + string(StateEnabled), + string(StateInvalid), + } +} + +func (s *State) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseState(input string) (*State, error) { + vals := map[string]State{ + "disabled": StateDisabled, + "enabled": StateEnabled, + "invalid": StateInvalid, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := State(input) + return &out, nil +} + +type TriggerType string + +const ( + TriggerTypeForcedUpgrade TriggerType = "ForcedUpgrade" + TriggerTypeUserTriggered TriggerType = "UserTriggered" +) + +func PossibleValuesForTriggerType() []string { + return []string{ + string(TriggerTypeForcedUpgrade), + string(TriggerTypeUserTriggered), + } +} + +func (s *TriggerType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseTriggerType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseTriggerType(input string) (*TriggerType, error) { + vals := map[string]TriggerType{ + "forcedupgrade": TriggerTypeForcedUpgrade, + "usertriggered": TriggerTypeUserTriggered, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TriggerType(input) + return &out, nil +} + +type UsagesUnit string + +const ( + UsagesUnitBytes UsagesUnit = "Bytes" + UsagesUnitBytesPerSecond UsagesUnit = "BytesPerSecond" + UsagesUnitCount UsagesUnit = "Count" + UsagesUnitCountPerSecond UsagesUnit = "CountPerSecond" + UsagesUnitPercent UsagesUnit = "Percent" + UsagesUnitSeconds UsagesUnit = "Seconds" +) + +func PossibleValuesForUsagesUnit() []string { + return []string{ + string(UsagesUnitBytes), + string(UsagesUnitBytesPerSecond), + string(UsagesUnitCount), + string(UsagesUnitCountPerSecond), + string(UsagesUnitPercent), + string(UsagesUnitSeconds), + } +} + +func (s *UsagesUnit) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUsagesUnit(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUsagesUnit(input string) (*UsagesUnit, error) { + vals := map[string]UsagesUnit{ + "bytes": UsagesUnitBytes, + "bytespersecond": UsagesUnitBytesPerSecond, + "count": UsagesUnitCount, + "countpersecond": UsagesUnitCountPerSecond, + "percent": UsagesUnitPercent, + "seconds": UsagesUnitSeconds, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UsagesUnit(input) + return &out, nil +} + +type VaultPrivateEndpointState string + +const ( + VaultPrivateEndpointStateEnabled VaultPrivateEndpointState = "Enabled" + VaultPrivateEndpointStateNone VaultPrivateEndpointState = "None" +) + +func PossibleValuesForVaultPrivateEndpointState() []string { + return []string{ + string(VaultPrivateEndpointStateEnabled), + string(VaultPrivateEndpointStateNone), + } +} + +func (s *VaultPrivateEndpointState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVaultPrivateEndpointState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVaultPrivateEndpointState(input string) (*VaultPrivateEndpointState, error) { + vals := map[string]VaultPrivateEndpointState{ + "enabled": VaultPrivateEndpointStateEnabled, + "none": VaultPrivateEndpointStateNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultPrivateEndpointState(input) + return &out, nil +} + +type VaultSubResourceType string + +const ( + VaultSubResourceTypeAzureBackup VaultSubResourceType = "AzureBackup" + VaultSubResourceTypeAzureBackupSecondary VaultSubResourceType = "AzureBackup_secondary" + VaultSubResourceTypeAzureSiteRecovery VaultSubResourceType = "AzureSiteRecovery" +) + +func PossibleValuesForVaultSubResourceType() []string { + return []string{ + string(VaultSubResourceTypeAzureBackup), + string(VaultSubResourceTypeAzureBackupSecondary), + string(VaultSubResourceTypeAzureSiteRecovery), + } +} + +func (s *VaultSubResourceType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVaultSubResourceType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVaultSubResourceType(input string) (*VaultSubResourceType, error) { + vals := map[string]VaultSubResourceType{ + "azurebackup": VaultSubResourceTypeAzureBackup, + "azurebackup_secondary": VaultSubResourceTypeAzureBackupSecondary, + "azuresiterecovery": VaultSubResourceTypeAzureSiteRecovery, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultSubResourceType(input) + return &out, nil +} + +type VaultUpgradeState string + +const ( + VaultUpgradeStateFailed VaultUpgradeState = "Failed" + VaultUpgradeStateInProgress VaultUpgradeState = "InProgress" + VaultUpgradeStateUnknown VaultUpgradeState = "Unknown" + VaultUpgradeStateUpgraded VaultUpgradeState = "Upgraded" +) + +func PossibleValuesForVaultUpgradeState() []string { + return []string{ + string(VaultUpgradeStateFailed), + string(VaultUpgradeStateInProgress), + string(VaultUpgradeStateUnknown), + string(VaultUpgradeStateUpgraded), + } +} + +func (s *VaultUpgradeState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVaultUpgradeState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVaultUpgradeState(input string) (*VaultUpgradeState, error) { + vals := map[string]VaultUpgradeState{ + "failed": VaultUpgradeStateFailed, + "inprogress": VaultUpgradeStateInProgress, + "unknown": VaultUpgradeStateUnknown, + "upgraded": VaultUpgradeStateUpgraded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VaultUpgradeState(input) + return &out, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/id_certificate.go b/resource-manager/recoveryservices/2025-08-01/vaults/id_certificate.go new file mode 100644 index 00000000000..111607329c3 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/id_certificate.go @@ -0,0 +1,139 @@ +package vaults + +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(&CertificateId{}) +} + +var _ resourceids.ResourceId = &CertificateId{} + +// CertificateId is a struct representing the Resource ID for a Certificate +type CertificateId struct { + SubscriptionId string + ResourceGroupName string + VaultName string + CertificateName string +} + +// NewCertificateID returns a new CertificateId struct +func NewCertificateID(subscriptionId string, resourceGroupName string, vaultName string, certificateName string) CertificateId { + return CertificateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + CertificateName: certificateName, + } +} + +// ParseCertificateID parses 'input' into a CertificateId +func ParseCertificateID(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(&CertificateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CertificateId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCertificateIDInsensitively parses 'input' case-insensitively into a CertificateId +// note: this method should only be used for API response data and not user input +func ParseCertificateIDInsensitively(input string) (*CertificateId, error) { + parser := resourceids.NewParserFromResourceIdType(&CertificateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CertificateId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CertificateId) 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.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) + } + + if id.CertificateName, ok = input.Parsed["certificateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "certificateName", input) + } + + return nil +} + +// ValidateCertificateID checks that 'input' can be parsed as a Certificate ID +func ValidateCertificateID(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 := ParseCertificateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Certificate ID +func (id CertificateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/certificates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.CertificateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Certificate ID +func (id CertificateId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + resourceids.StaticSegment("staticCertificates", "certificates", "certificates"), + resourceids.UserSpecifiedSegment("certificateName", "certificateName"), + } +} + +// String returns a human-readable description of this Certificate ID +func (id CertificateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Certificate Name: %q", id.CertificateName), + } + return fmt.Sprintf("Certificate (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/id_certificate_test.go b/resource-manager/recoveryservices/2025-08-01/vaults/id_certificate_test.go new file mode 100644 index 00000000000..1d016880229 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/id_certificate_test.go @@ -0,0 +1,327 @@ +package vaults + +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 = &CertificateId{} + +func TestNewCertificateID(t *testing.T) { + id := NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "certificateName") + + 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.VaultName != "vaultName" { + t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + } + + if id.CertificateName != "certificateName" { + t.Fatalf("Expected %q but got %q for Segment 'CertificateName'", id.CertificateName, "certificateName") + } +} + +func TestFormatCertificateID(t *testing.T) { + actual := NewCertificateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "certificateName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/certificates/certificateName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCertificateID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CertificateId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/certificates", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/certificates/certificateName", + Expected: &CertificateId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + CertificateName: "certificateName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/certificates/certificateName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCertificateID(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + if actual.CertificateName != v.Expected.CertificateName { + t.Fatalf("Expected %q but got %q for CertificateName", v.Expected.CertificateName, actual.CertificateName) + } + + } +} + +func TestParseCertificateIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CertificateId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/certificates", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/cErTiFiCaTeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/certificates/certificateName", + Expected: &CertificateId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + CertificateName: "certificateName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/certificates/certificateName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/cErTiFiCaTeS/cErTiFiCaTeNaMe", + Expected: &CertificateId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VaultName: "vAuLtNaMe", + CertificateName: "cErTiFiCaTeNaMe", + }, + }, + { + // 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.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/cErTiFiCaTeS/cErTiFiCaTeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCertificateIDInsensitively(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + if actual.CertificateName != v.Expected.CertificateName { + t.Fatalf("Expected %q but got %q for CertificateName", v.Expected.CertificateName, actual.CertificateName) + } + + } +} + +func TestSegmentsForCertificateId(t *testing.T) { + segments := CertificateId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CertificateId 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/recoveryservices/2025-08-01/vaults/id_registeredidentity.go b/resource-manager/recoveryservices/2025-08-01/vaults/id_registeredidentity.go new file mode 100644 index 00000000000..724ca711126 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/id_registeredidentity.go @@ -0,0 +1,139 @@ +package vaults + +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(&RegisteredIdentityId{}) +} + +var _ resourceids.ResourceId = &RegisteredIdentityId{} + +// RegisteredIdentityId is a struct representing the Resource ID for a Registered Identity +type RegisteredIdentityId struct { + SubscriptionId string + ResourceGroupName string + VaultName string + RegisteredIdentityName string +} + +// NewRegisteredIdentityID returns a new RegisteredIdentityId struct +func NewRegisteredIdentityID(subscriptionId string, resourceGroupName string, vaultName string, registeredIdentityName string) RegisteredIdentityId { + return RegisteredIdentityId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + RegisteredIdentityName: registeredIdentityName, + } +} + +// ParseRegisteredIdentityID parses 'input' into a RegisteredIdentityId +func ParseRegisteredIdentityID(input string) (*RegisteredIdentityId, error) { + parser := resourceids.NewParserFromResourceIdType(&RegisteredIdentityId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RegisteredIdentityId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRegisteredIdentityIDInsensitively parses 'input' case-insensitively into a RegisteredIdentityId +// note: this method should only be used for API response data and not user input +func ParseRegisteredIdentityIDInsensitively(input string) (*RegisteredIdentityId, error) { + parser := resourceids.NewParserFromResourceIdType(&RegisteredIdentityId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RegisteredIdentityId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RegisteredIdentityId) 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.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) + } + + if id.RegisteredIdentityName, ok = input.Parsed["registeredIdentityName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "registeredIdentityName", input) + } + + return nil +} + +// ValidateRegisteredIdentityID checks that 'input' can be parsed as a Registered Identity ID +func ValidateRegisteredIdentityID(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 := ParseRegisteredIdentityID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Registered Identity ID +func (id RegisteredIdentityId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s/registeredIdentities/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName, id.RegisteredIdentityName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Registered Identity ID +func (id RegisteredIdentityId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + resourceids.StaticSegment("staticRegisteredIdentities", "registeredIdentities", "registeredIdentities"), + resourceids.UserSpecifiedSegment("registeredIdentityName", "registeredIdentityName"), + } +} + +// String returns a human-readable description of this Registered Identity ID +func (id RegisteredIdentityId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + fmt.Sprintf("Registered Identity Name: %q", id.RegisteredIdentityName), + } + return fmt.Sprintf("Registered Identity (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/id_registeredidentity_test.go b/resource-manager/recoveryservices/2025-08-01/vaults/id_registeredidentity_test.go new file mode 100644 index 00000000000..6ef346dd15e --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/id_registeredidentity_test.go @@ -0,0 +1,327 @@ +package vaults + +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 = &RegisteredIdentityId{} + +func TestNewRegisteredIdentityID(t *testing.T) { + id := NewRegisteredIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "registeredIdentityName") + + 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.VaultName != "vaultName" { + t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + } + + if id.RegisteredIdentityName != "registeredIdentityName" { + t.Fatalf("Expected %q but got %q for Segment 'RegisteredIdentityName'", id.RegisteredIdentityName, "registeredIdentityName") + } +} + +func TestFormatRegisteredIdentityID(t *testing.T) { + actual := NewRegisteredIdentityID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName", "registeredIdentityName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/registeredIdentities/registeredIdentityName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRegisteredIdentityID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RegisteredIdentityId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/registeredIdentities", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/registeredIdentities/registeredIdentityName", + Expected: &RegisteredIdentityId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + RegisteredIdentityName: "registeredIdentityName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/registeredIdentities/registeredIdentityName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRegisteredIdentityID(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + if actual.RegisteredIdentityName != v.Expected.RegisteredIdentityName { + t.Fatalf("Expected %q but got %q for RegisteredIdentityName", v.Expected.RegisteredIdentityName, actual.RegisteredIdentityName) + } + + } +} + +func TestParseRegisteredIdentityIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RegisteredIdentityId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/registeredIdentities", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/rEgIsTeReDiDeNtItIeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/registeredIdentities/registeredIdentityName", + Expected: &RegisteredIdentityId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + RegisteredIdentityName: "registeredIdentityName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/registeredIdentities/registeredIdentityName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/rEgIsTeReDiDeNtItIeS/rEgIsTeReDiDeNtItYnAmE", + Expected: &RegisteredIdentityId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VaultName: "vAuLtNaMe", + RegisteredIdentityName: "rEgIsTeReDiDeNtItYnAmE", + }, + }, + { + // 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.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/rEgIsTeReDiDeNtItIeS/rEgIsTeReDiDeNtItYnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRegisteredIdentityIDInsensitively(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + if actual.RegisteredIdentityName != v.Expected.RegisteredIdentityName { + t.Fatalf("Expected %q but got %q for RegisteredIdentityName", v.Expected.RegisteredIdentityName, actual.RegisteredIdentityName) + } + + } +} + +func TestSegmentsForRegisteredIdentityId(t *testing.T) { + segments := RegisteredIdentityId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RegisteredIdentityId 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/recoveryservices/2025-08-01/vaults/id_vault.go b/resource-manager/recoveryservices/2025-08-01/vaults/id_vault.go new file mode 100644 index 00000000000..9c23a25bcb7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/id_vault.go @@ -0,0 +1,130 @@ +package vaults + +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(&VaultId{}) +} + +var _ resourceids.ResourceId = &VaultId{} + +// VaultId is a struct representing the Resource ID for a Vault +type VaultId struct { + SubscriptionId string + ResourceGroupName string + VaultName string +} + +// NewVaultID returns a new VaultId struct +func NewVaultID(subscriptionId string, resourceGroupName string, vaultName string) VaultId { + return VaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VaultName: vaultName, + } +} + +// ParseVaultID parses 'input' into a VaultId +func ParseVaultID(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&VaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVaultIDInsensitively parses 'input' case-insensitively into a VaultId +// note: this method should only be used for API response data and not user input +func ParseVaultIDInsensitively(input string) (*VaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&VaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VaultId) 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.VaultName, ok = input.Parsed["vaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vaultName", input) + } + + return nil +} + +// ValidateVaultID checks that 'input' can be parsed as a Vault ID +func ValidateVaultID(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 := ParseVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Vault ID +func (id VaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.RecoveryServices/vaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Vault ID +func (id VaultId) 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("staticMicrosoftRecoveryServices", "Microsoft.RecoveryServices", "Microsoft.RecoveryServices"), + resourceids.StaticSegment("staticVaults", "vaults", "vaults"), + resourceids.UserSpecifiedSegment("vaultName", "vaultName"), + } +} + +// String returns a human-readable description of this Vault ID +func (id VaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vault Name: %q", id.VaultName), + } + return fmt.Sprintf("Vault (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/id_vault_test.go b/resource-manager/recoveryservices/2025-08-01/vaults/id_vault_test.go new file mode 100644 index 00000000000..0641240427b --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/id_vault_test.go @@ -0,0 +1,282 @@ +package vaults + +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 = &VaultId{} + +func TestNewVaultID(t *testing.T) { + id := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName") + + 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.VaultName != "vaultName" { + t.Fatalf("Expected %q but got %q for Segment 'VaultName'", id.VaultName, "vaultName") + } +} + +func TestFormatVaultID(t *testing.T) { + actual := NewVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vaultName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVaultID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVaultID(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + } +} + +func TestParseVaultIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VaultId + }{ + { + // 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.RecoveryServices", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VaultName: "vaultName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.RecoveryServices/vaults/vaultName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe", + Expected: &VaultId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VaultName: "vAuLtNaMe", + }, + }, + { + // 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.rEcOvErYsErViCeS/vAuLtS/vAuLtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVaultIDInsensitively(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.VaultName != v.Expected.VaultName { + t.Fatalf("Expected %q but got %q for VaultName", v.Expected.VaultName, actual.VaultName) + } + + } +} + +func TestSegmentsForVaultId(t *testing.T) { + segments := VaultId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VaultId 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/recoveryservices/2025-08-01/vaults/method_createorupdate.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_createorupdate.go new file mode 100644 index 00000000000..f52787d1b5a --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_createorupdate.go @@ -0,0 +1,104 @@ +package vaults + +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 CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Vault +} + +type CreateOrUpdateOperationOptions struct { + XMsAuthorizationAuxiliary *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.XMsAuthorizationAuxiliary != nil { + out.Append("x-ms-authorization-auxiliary", fmt.Sprintf("%v", *o.XMsAuthorizationAuxiliary)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c VaultsClient) CreateOrUpdate(ctx context.Context, id VaultId, input Vault, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + 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 +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VaultsClient) CreateOrUpdateThenPoll(ctx context.Context, id VaultId, input Vault, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/method_delete.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_delete.go new file mode 100644 index 00000000000..2b8f5be41af --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_delete.go @@ -0,0 +1,70 @@ +package vaults + +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 VaultsClient) Delete(ctx context.Context, id VaultId) (result DeleteOperationResponse, 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 +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VaultsClient) DeleteThenPoll(ctx context.Context, id VaultId) 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/recoveryservices/2025-08-01/vaults/method_get.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_get.go new file mode 100644 index 00000000000..64a64f258ff --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_get.go @@ -0,0 +1,53 @@ +package vaults + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Vault +} + +// Get ... +func (c VaultsClient) Get(ctx context.Context, id VaultId) (result GetOperationResponse, 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 Vault + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/method_listbysubscriptionid.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_listbysubscriptionid.go new file mode 100644 index 00000000000..c289dedd82f --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_listbysubscriptionid.go @@ -0,0 +1,106 @@ +package vaults + +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 ListBySubscriptionIdOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Vault +} + +type ListBySubscriptionIdCompleteResult struct { + LatestHttpResponse *http.Response + Items []Vault +} + +type ListBySubscriptionIdCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionIdCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscriptionId ... +func (c VaultsClient) ListBySubscriptionId(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionIdOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionIdCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.RecoveryServices/vaults", 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 *[]Vault `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionIdComplete retrieves all the results into a single object +func (c VaultsClient) ListBySubscriptionIdComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionIdCompleteResult, error) { + return c.ListBySubscriptionIdCompleteMatchingPredicate(ctx, id, VaultOperationPredicate{}) +} + +// ListBySubscriptionIdCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VaultsClient) ListBySubscriptionIdCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VaultOperationPredicate) (result ListBySubscriptionIdCompleteResult, err error) { + items := make([]Vault, 0) + + resp, err := c.ListBySubscriptionId(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 = ListBySubscriptionIdCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/method_registeredidentitiesdelete.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_registeredidentitiesdelete.go new file mode 100644 index 00000000000..2b4b12a6588 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_registeredidentitiesdelete.go @@ -0,0 +1,46 @@ +package vaults + +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 RegisteredIdentitiesDeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// RegisteredIdentitiesDelete ... +func (c VaultsClient) RegisteredIdentitiesDelete(ctx context.Context, id RegisteredIdentityId) (result RegisteredIdentitiesDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/method_replicationusageslist.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_replicationusageslist.go new file mode 100644 index 00000000000..23a8ade529a --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_replicationusageslist.go @@ -0,0 +1,105 @@ +package vaults + +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 ReplicationUsagesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ReplicationUsage +} + +type ReplicationUsagesListCompleteResult struct { + LatestHttpResponse *http.Response + Items []ReplicationUsage +} + +type ReplicationUsagesListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ReplicationUsagesListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ReplicationUsagesList ... +func (c VaultsClient) ReplicationUsagesList(ctx context.Context, id VaultId) (result ReplicationUsagesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ReplicationUsagesListCustomPager{}, + Path: fmt.Sprintf("%s/replicationUsages", 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 *[]ReplicationUsage `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ReplicationUsagesListComplete retrieves all the results into a single object +func (c VaultsClient) ReplicationUsagesListComplete(ctx context.Context, id VaultId) (ReplicationUsagesListCompleteResult, error) { + return c.ReplicationUsagesListCompleteMatchingPredicate(ctx, id, ReplicationUsageOperationPredicate{}) +} + +// ReplicationUsagesListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VaultsClient) ReplicationUsagesListCompleteMatchingPredicate(ctx context.Context, id VaultId, predicate ReplicationUsageOperationPredicate) (result ReplicationUsagesListCompleteResult, err error) { + items := make([]ReplicationUsage, 0) + + resp, err := c.ReplicationUsagesList(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 = ReplicationUsagesListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/method_update.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_update.go new file mode 100644 index 00000000000..fed13b914bf --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_update.go @@ -0,0 +1,104 @@ +package vaults + +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 *Vault +} + +type UpdateOperationOptions struct { + XMsAuthorizationAuxiliary *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.XMsAuthorizationAuxiliary != nil { + out.Append("x-ms-authorization-auxiliary", fmt.Sprintf("%v", *o.XMsAuthorizationAuxiliary)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c VaultsClient) Update(ctx context.Context, id VaultId, input PatchVault, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + OptionsObject: options, + 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 VaultsClient) UpdateThenPoll(ctx context.Context, id VaultId, input PatchVault, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/recoveryservices/2025-08-01/vaults/method_usageslistbyvaults.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_usageslistbyvaults.go new file mode 100644 index 00000000000..386060d255c --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_usageslistbyvaults.go @@ -0,0 +1,105 @@ +package vaults + +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 UsagesListByVaultsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VaultUsage +} + +type UsagesListByVaultsCompleteResult struct { + LatestHttpResponse *http.Response + Items []VaultUsage +} + +type UsagesListByVaultsCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *UsagesListByVaultsCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// UsagesListByVaults ... +func (c VaultsClient) UsagesListByVaults(ctx context.Context, id VaultId) (result UsagesListByVaultsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &UsagesListByVaultsCustomPager{}, + Path: fmt.Sprintf("%s/usages", 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 *[]VaultUsage `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// UsagesListByVaultsComplete retrieves all the results into a single object +func (c VaultsClient) UsagesListByVaultsComplete(ctx context.Context, id VaultId) (UsagesListByVaultsCompleteResult, error) { + return c.UsagesListByVaultsCompleteMatchingPredicate(ctx, id, VaultUsageOperationPredicate{}) +} + +// UsagesListByVaultsCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VaultsClient) UsagesListByVaultsCompleteMatchingPredicate(ctx context.Context, id VaultId, predicate VaultUsageOperationPredicate) (result UsagesListByVaultsCompleteResult, err error) { + items := make([]VaultUsage, 0) + + resp, err := c.UsagesListByVaults(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 = UsagesListByVaultsCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/method_vaultcertificatescreate.go b/resource-manager/recoveryservices/2025-08-01/vaults/method_vaultcertificatescreate.go new file mode 100644 index 00000000000..f696af799ff --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/method_vaultcertificatescreate.go @@ -0,0 +1,57 @@ +package vaults + +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 VaultCertificatesCreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VaultCertificateResponse +} + +// VaultCertificatesCreate ... +func (c VaultsClient) VaultCertificatesCreate(ctx context.Context, id CertificateId, input CertificateRequest) (result VaultCertificatesCreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 VaultCertificateResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_associatedidentity.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_associatedidentity.go new file mode 100644 index 00000000000..3cd9bd3ccd0 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_associatedidentity.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssociatedIdentity struct { + OperationIdentityType *IdentityType `json:"operationIdentityType,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_azuremonitoralertsettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_azuremonitoralertsettings.go new file mode 100644 index 00000000000..3f36e0be907 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_azuremonitoralertsettings.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureMonitorAlertSettings struct { + AlertsForAllFailoverIssues *AlertsState `json:"alertsForAllFailoverIssues,omitempty"` + AlertsForAllJobFailures *AlertsState `json:"alertsForAllJobFailures,omitempty"` + AlertsForAllReplicationIssues *AlertsState `json:"alertsForAllReplicationIssues,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_certificaterequest.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_certificaterequest.go new file mode 100644 index 00000000000..201c993aee6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_certificaterequest.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CertificateRequest struct { + Properties *RawCertificateData `json:"properties,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_classicalertsettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_classicalertsettings.go new file mode 100644 index 00000000000..bf08cd1a80e --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_classicalertsettings.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ClassicAlertSettings struct { + AlertsForCriticalOperations *AlertsState `json:"alertsForCriticalOperations,omitempty"` + EmailNotificationsForSiteRecovery *AlertsState `json:"emailNotificationsForSiteRecovery,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_cmkkekidentity.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_cmkkekidentity.go new file mode 100644 index 00000000000..1e5e7be3d2d --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_cmkkekidentity.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKekIdentity struct { + UseSystemAssignedIdentity *bool `json:"useSystemAssignedIdentity,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_cmkkeyvaultproperties.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_cmkkeyvaultproperties.go new file mode 100644 index 00000000000..c53f530b9f5 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_cmkkeyvaultproperties.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CmkKeyVaultProperties struct { + KeyUri *string `json:"keyUri,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_crosssubscriptionrestoresettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_crosssubscriptionrestoresettings.go new file mode 100644 index 00000000000..4a4fecb8bdd --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_crosssubscriptionrestoresettings.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CrossSubscriptionRestoreSettings struct { + CrossSubscriptionRestoreState *CrossSubscriptionRestoreState `json:"crossSubscriptionRestoreState,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_immutabilitysettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_immutabilitysettings.go new file mode 100644 index 00000000000..f52ae97a4c3 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_immutabilitysettings.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImmutabilitySettings struct { + State *ImmutabilityState `json:"state,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_jobssummary.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_jobssummary.go new file mode 100644 index 00000000000..2ba3e5b9c42 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_jobssummary.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type JobsSummary struct { + FailedJobs *int64 `json:"failedJobs,omitempty"` + InProgressJobs *int64 `json:"inProgressJobs,omitempty"` + SuspendedJobs *int64 `json:"suspendedJobs,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_monitoringsettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_monitoringsettings.go new file mode 100644 index 00000000000..391ede46ae2 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_monitoringsettings.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSettings struct { + AzureMonitorAlertSettings *AzureMonitorAlertSettings `json:"azureMonitorAlertSettings,omitempty"` + ClassicAlertSettings *ClassicAlertSettings `json:"classicAlertSettings,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_monitoringsummary.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_monitoringsummary.go new file mode 100644 index 00000000000..a2305a3ab37 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_monitoringsummary.go @@ -0,0 +1,13 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonitoringSummary struct { + DeprecatedProviderCount *int64 `json:"deprecatedProviderCount,omitempty"` + EventsCount *int64 `json:"eventsCount,omitempty"` + SupportedProviderCount *int64 `json:"supportedProviderCount,omitempty"` + UnHealthyProviderCount *int64 `json:"unHealthyProviderCount,omitempty"` + UnHealthyVMCount *int64 `json:"unHealthyVmCount,omitempty"` + UnsupportedProviderCount *int64 `json:"unsupportedProviderCount,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_nameinfo.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_nameinfo.go new file mode 100644 index 00000000000..d06544864ad --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_nameinfo.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NameInfo struct { + LocalizedValue *string `json:"localizedValue,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_patchvault.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_patchvault.go new file mode 100644 index 00000000000..92e3ba243fa --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_patchvault.go @@ -0,0 +1,22 @@ +package vaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 PatchVault struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpoint.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpoint.go new file mode 100644 index 00000000000..64ce35a3d98 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpoint.go @@ -0,0 +1,8 @@ +package vaults + +// 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/recoveryservices/2025-08-01/vaults/model_privateendpointconnection.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpointconnection.go new file mode 100644 index 00000000000..687aefc111c --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpointconnection.go @@ -0,0 +1,11 @@ +package vaults + +// 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 { + GroupIds *[]VaultSubResourceType `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpointconnectionvaultproperties.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpointconnectionvaultproperties.go new file mode 100644 index 00000000000..5758db1bfa3 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_privateendpointconnectionvaultproperties.go @@ -0,0 +1,12 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionVaultProperties struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnection `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_privatelinkserviceconnectionstate.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..b07724e0e27 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package vaults + +// 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 *PrivateEndpointConnectionStatus `json:"status,omitempty"` +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_erroradditionalinfo.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_rawcertificatedata.go similarity index 51% rename from resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_erroradditionalinfo.go rename to resource-manager/recoveryservices/2025-08-01/vaults/model_rawcertificatedata.go index f35071cbfae..045519f350d 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_erroradditionalinfo.go +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_rawcertificatedata.go @@ -1,9 +1,9 @@ -package backupprotectableitems +package vaults // 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"` +type RawCertificateData struct { + AuthType *AuthType `json:"authType,omitempty"` + Certificate *string `json:"certificate,omitempty"` } diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_replicationusage.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_replicationusage.go new file mode 100644 index 00000000000..2f98c2fd18e --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_replicationusage.go @@ -0,0 +1,13 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicationUsage struct { + JobsSummary *JobsSummary `json:"jobsSummary,omitempty"` + MonitoringSummary *MonitoringSummary `json:"monitoringSummary,omitempty"` + ProtectedItemCount *int64 `json:"protectedItemCount,omitempty"` + RecoveryPlanCount *int64 `json:"recoveryPlanCount,omitempty"` + RecoveryServicesProviderAuthType *int64 `json:"recoveryServicesProviderAuthType,omitempty"` + RegisteredServersCount *int64 `json:"registeredServersCount,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificateandaaddetails.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificateandaaddetails.go new file mode 100644 index 00000000000..c252eba5285 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificateandaaddetails.go @@ -0,0 +1,99 @@ +package vaults + +import ( + "encoding/json" + "fmt" + "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. + +var _ ResourceCertificateDetails = ResourceCertificateAndAadDetails{} + +type ResourceCertificateAndAadDetails struct { + AadAudience *string `json:"aadAudience,omitempty"` + AadAuthority string `json:"aadAuthority"` + AadTenantId string `json:"aadTenantId"` + AzureManagementEndpointAudience string `json:"azureManagementEndpointAudience"` + ServicePrincipalClientId string `json:"servicePrincipalClientId"` + ServicePrincipalObjectId string `json:"servicePrincipalObjectId"` + ServiceResourceId *string `json:"serviceResourceId,omitempty"` + + // Fields inherited from ResourceCertificateDetails + + AuthType string `json:"authType"` + Certificate *string `json:"certificate,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Issuer *string `json:"issuer,omitempty"` + ResourceId *int64 `json:"resourceId,omitempty"` + Subject *string `json:"subject,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ValidFrom *string `json:"validFrom,omitempty"` + ValidTo *string `json:"validTo,omitempty"` +} + +func (s ResourceCertificateAndAadDetails) ResourceCertificateDetails() BaseResourceCertificateDetailsImpl { + return BaseResourceCertificateDetailsImpl{ + AuthType: s.AuthType, + Certificate: s.Certificate, + FriendlyName: s.FriendlyName, + Issuer: s.Issuer, + ResourceId: s.ResourceId, + Subject: s.Subject, + Thumbprint: s.Thumbprint, + ValidFrom: s.ValidFrom, + ValidTo: s.ValidTo, + } +} + +func (o *ResourceCertificateAndAadDetails) GetValidFromAsTime() (*time.Time, error) { + if o.ValidFrom == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ValidFrom, "2006-01-02T15:04:05Z07:00") +} + +func (o *ResourceCertificateAndAadDetails) SetValidFromAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ValidFrom = &formatted +} + +func (o *ResourceCertificateAndAadDetails) GetValidToAsTime() (*time.Time, error) { + if o.ValidTo == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ValidTo, "2006-01-02T15:04:05Z07:00") +} + +func (o *ResourceCertificateAndAadDetails) SetValidToAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ValidTo = &formatted +} + +var _ json.Marshaler = ResourceCertificateAndAadDetails{} + +func (s ResourceCertificateAndAadDetails) MarshalJSON() ([]byte, error) { + type wrapper ResourceCertificateAndAadDetails + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ResourceCertificateAndAadDetails: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ResourceCertificateAndAadDetails: %+v", err) + } + + decoded["authType"] = "AzureActiveDirectory" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ResourceCertificateAndAadDetails: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificateandacsdetails.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificateandacsdetails.go new file mode 100644 index 00000000000..669384d10fa --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificateandacsdetails.go @@ -0,0 +1,95 @@ +package vaults + +import ( + "encoding/json" + "fmt" + "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. + +var _ ResourceCertificateDetails = ResourceCertificateAndAcsDetails{} + +type ResourceCertificateAndAcsDetails struct { + GlobalAcsHostName string `json:"globalAcsHostName"` + GlobalAcsNamespace string `json:"globalAcsNamespace"` + GlobalAcsRPRealm string `json:"globalAcsRPRealm"` + + // Fields inherited from ResourceCertificateDetails + + AuthType string `json:"authType"` + Certificate *string `json:"certificate,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Issuer *string `json:"issuer,omitempty"` + ResourceId *int64 `json:"resourceId,omitempty"` + Subject *string `json:"subject,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ValidFrom *string `json:"validFrom,omitempty"` + ValidTo *string `json:"validTo,omitempty"` +} + +func (s ResourceCertificateAndAcsDetails) ResourceCertificateDetails() BaseResourceCertificateDetailsImpl { + return BaseResourceCertificateDetailsImpl{ + AuthType: s.AuthType, + Certificate: s.Certificate, + FriendlyName: s.FriendlyName, + Issuer: s.Issuer, + ResourceId: s.ResourceId, + Subject: s.Subject, + Thumbprint: s.Thumbprint, + ValidFrom: s.ValidFrom, + ValidTo: s.ValidTo, + } +} + +func (o *ResourceCertificateAndAcsDetails) GetValidFromAsTime() (*time.Time, error) { + if o.ValidFrom == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ValidFrom, "2006-01-02T15:04:05Z07:00") +} + +func (o *ResourceCertificateAndAcsDetails) SetValidFromAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ValidFrom = &formatted +} + +func (o *ResourceCertificateAndAcsDetails) GetValidToAsTime() (*time.Time, error) { + if o.ValidTo == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ValidTo, "2006-01-02T15:04:05Z07:00") +} + +func (o *ResourceCertificateAndAcsDetails) SetValidToAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ValidTo = &formatted +} + +var _ json.Marshaler = ResourceCertificateAndAcsDetails{} + +func (s ResourceCertificateAndAcsDetails) MarshalJSON() ([]byte, error) { + type wrapper ResourceCertificateAndAcsDetails + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ResourceCertificateAndAcsDetails: %+v", err) + } + + var decoded map[string]interface{} + if err = json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ResourceCertificateAndAcsDetails: %+v", err) + } + + decoded["authType"] = "AccessControlService" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ResourceCertificateAndAcsDetails: %+v", err) + } + + return encoded, nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificatedetails.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificatedetails.go new file mode 100644 index 00000000000..f560a7058ff --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_resourcecertificatedetails.go @@ -0,0 +1,91 @@ +package vaults + +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 ResourceCertificateDetails interface { + ResourceCertificateDetails() BaseResourceCertificateDetailsImpl +} + +var _ ResourceCertificateDetails = BaseResourceCertificateDetailsImpl{} + +type BaseResourceCertificateDetailsImpl struct { + AuthType string `json:"authType"` + Certificate *string `json:"certificate,omitempty"` + FriendlyName *string `json:"friendlyName,omitempty"` + Issuer *string `json:"issuer,omitempty"` + ResourceId *int64 `json:"resourceId,omitempty"` + Subject *string `json:"subject,omitempty"` + Thumbprint *string `json:"thumbprint,omitempty"` + ValidFrom *string `json:"validFrom,omitempty"` + ValidTo *string `json:"validTo,omitempty"` +} + +func (s BaseResourceCertificateDetailsImpl) ResourceCertificateDetails() BaseResourceCertificateDetailsImpl { + return s +} + +var _ ResourceCertificateDetails = RawResourceCertificateDetailsImpl{} + +// RawResourceCertificateDetailsImpl 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 RawResourceCertificateDetailsImpl struct { + resourceCertificateDetails BaseResourceCertificateDetailsImpl + Type string + Values map[string]interface{} +} + +func (s RawResourceCertificateDetailsImpl) ResourceCertificateDetails() BaseResourceCertificateDetailsImpl { + return s.resourceCertificateDetails +} + +func UnmarshalResourceCertificateDetailsImplementation(input []byte) (ResourceCertificateDetails, 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 ResourceCertificateDetails into map[string]interface: %+v", err) + } + + var value string + if v, ok := temp["authType"]; ok { + value = fmt.Sprintf("%v", v) + } + + if strings.EqualFold(value, "AzureActiveDirectory") { + var out ResourceCertificateAndAadDetails + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ResourceCertificateAndAadDetails: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "AccessControlService") { + var out ResourceCertificateAndAcsDetails + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ResourceCertificateAndAcsDetails: %+v", err) + } + return out, nil + } + + var parent BaseResourceCertificateDetailsImpl + if err := json.Unmarshal(input, &parent); err != nil { + return nil, fmt.Errorf("unmarshaling into BaseResourceCertificateDetailsImpl: %+v", err) + } + + return RawResourceCertificateDetailsImpl{ + resourceCertificateDetails: parent, + Type: value, + Values: temp, + }, nil + +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_restoresettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_restoresettings.go new file mode 100644 index 00000000000..b5126dbe263 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_restoresettings.go @@ -0,0 +1,8 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreSettings struct { + CrossSubscriptionRestoreSettings *CrossSubscriptionRestoreSettings `json:"crossSubscriptionRestoreSettings,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_securitysettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_securitysettings.go new file mode 100644 index 00000000000..c32fe717e5f --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_securitysettings.go @@ -0,0 +1,11 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecuritySettings struct { + ImmutabilitySettings *ImmutabilitySettings `json:"immutabilitySettings,omitempty"` + MultiUserAuthorization *MultiUserAuthorization `json:"multiUserAuthorization,omitempty"` + SoftDeleteSettings *SoftDeleteSettings `json:"softDeleteSettings,omitempty"` + SourceScanConfiguration *SourceScanConfiguration `json:"sourceScanConfiguration,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_sku.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_sku.go new file mode 100644 index 00000000000..d89e1340ee6 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_sku.go @@ -0,0 +1,12 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *string `json:"capacity,omitempty"` + Family *string `json:"family,omitempty"` + Name SkuName `json:"name"` + Size *string `json:"size,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_softdeletesettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_softdeletesettings.go new file mode 100644 index 00000000000..fb257ac28c7 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_softdeletesettings.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SoftDeleteSettings struct { + EnhancedSecurityState *EnhancedSecurityState `json:"enhancedSecurityState,omitempty"` + SoftDeleteRetentionPeriodInDays *int64 `json:"softDeleteRetentionPeriodInDays,omitempty"` + SoftDeleteState *SoftDeleteState `json:"softDeleteState,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_sourcescanconfiguration.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_sourcescanconfiguration.go new file mode 100644 index 00000000000..4101363f704 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_sourcescanconfiguration.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SourceScanConfiguration struct { + SourceScanIdentity *AssociatedIdentity `json:"sourceScanIdentity,omitempty"` + State *State `json:"state,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_upgradedetails.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_upgradedetails.go new file mode 100644 index 00000000000..f5e021983ab --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_upgradedetails.go @@ -0,0 +1,58 @@ +package vaults + +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 UpgradeDetails struct { + EndTimeUtc *string `json:"endTimeUtc,omitempty"` + LastUpdatedTimeUtc *string `json:"lastUpdatedTimeUtc,omitempty"` + Message *string `json:"message,omitempty"` + OperationId *string `json:"operationId,omitempty"` + PreviousResourceId *string `json:"previousResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + Status *VaultUpgradeState `json:"status,omitempty"` + TriggerType *TriggerType `json:"triggerType,omitempty"` + UpgradedResourceId *string `json:"upgradedResourceId,omitempty"` +} + +func (o *UpgradeDetails) GetEndTimeUtcAsTime() (*time.Time, error) { + if o.EndTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetEndTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetLastUpdatedTimeUtcAsTime() (*time.Time, error) { + if o.LastUpdatedTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastUpdatedTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetLastUpdatedTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastUpdatedTimeUtc = &formatted +} + +func (o *UpgradeDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_vault.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_vault.go new file mode 100644 index 00000000000..dc5d7d049c1 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_vault.go @@ -0,0 +1,22 @@ +package vaults + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 Vault struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VaultProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultcertificateresponse.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultcertificateresponse.go new file mode 100644 index 00000000000..ebf37880646 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultcertificateresponse.go @@ -0,0 +1,48 @@ +package vaults + +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 VaultCertificateResponse struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties ResourceCertificateDetails `json:"properties"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &VaultCertificateResponse{} + +func (s *VaultCertificateResponse) UnmarshalJSON(bytes []byte) error { + var decoded struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` + } + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + + s.Id = decoded.Id + s.Name = decoded.Name + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling VaultCertificateResponse into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := UnmarshalResourceCertificateDetailsImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'VaultCertificateResponse': %+v", err) + } + s.Properties = impl + } + + return nil +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultproperties.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultproperties.go new file mode 100644 index 00000000000..5942dc4f409 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultproperties.go @@ -0,0 +1,24 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultProperties struct { + BackupStorageVersion *BackupStorageVersion `json:"backupStorageVersion,omitempty"` + BcdrSecurityLevel *BCDRSecurityLevel `json:"bcdrSecurityLevel,omitempty"` + Encryption *VaultPropertiesEncryption `json:"encryption,omitempty"` + MonitoringSettings *MonitoringSettings `json:"monitoringSettings,omitempty"` + MoveDetails *VaultPropertiesMoveDetails `json:"moveDetails,omitempty"` + MoveState *ResourceMoveState `json:"moveState,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnectionVaultProperties `json:"privateEndpointConnections,omitempty"` + PrivateEndpointStateForBackup *VaultPrivateEndpointState `json:"privateEndpointStateForBackup,omitempty"` + PrivateEndpointStateForSiteRecovery *VaultPrivateEndpointState `json:"privateEndpointStateForSiteRecovery,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + RedundancySettings *VaultPropertiesRedundancySettings `json:"redundancySettings,omitempty"` + ResourceGuardOperationRequests *[]string `json:"resourceGuardOperationRequests,omitempty"` + RestoreSettings *RestoreSettings `json:"restoreSettings,omitempty"` + SecureScore *SecureScoreLevel `json:"secureScore,omitempty"` + SecuritySettings *SecuritySettings `json:"securitySettings,omitempty"` + UpgradeDetails *UpgradeDetails `json:"upgradeDetails,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesencryption.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesencryption.go new file mode 100644 index 00000000000..05c6effec1d --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesencryption.go @@ -0,0 +1,10 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesEncryption struct { + InfrastructureEncryption *InfrastructureEncryptionState `json:"infrastructureEncryption,omitempty"` + KekIdentity *CmkKekIdentity `json:"kekIdentity,omitempty"` + KeyVaultProperties *CmkKeyVaultProperties `json:"keyVaultProperties,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesmovedetails.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesmovedetails.go new file mode 100644 index 00000000000..b65be5a0669 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesmovedetails.go @@ -0,0 +1,42 @@ +package vaults + +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 VaultPropertiesMoveDetails struct { + CompletionTimeUtc *string `json:"completionTimeUtc,omitempty"` + OperationId *string `json:"operationId,omitempty"` + SourceResourceId *string `json:"sourceResourceId,omitempty"` + StartTimeUtc *string `json:"startTimeUtc,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` +} + +func (o *VaultPropertiesMoveDetails) GetCompletionTimeUtcAsTime() (*time.Time, error) { + if o.CompletionTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CompletionTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetCompletionTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CompletionTimeUtc = &formatted +} + +func (o *VaultPropertiesMoveDetails) GetStartTimeUtcAsTime() (*time.Time, error) { + if o.StartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultPropertiesMoveDetails) SetStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTimeUtc = &formatted +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesredundancysettings.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesredundancysettings.go new file mode 100644 index 00000000000..2d1174f221f --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultpropertiesredundancysettings.go @@ -0,0 +1,9 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultPropertiesRedundancySettings struct { + CrossRegionRestore *CrossRegionRestore `json:"crossRegionRestore,omitempty"` + StandardTierStorageRedundancy *StandardTierStorageRedundancy `json:"standardTierStorageRedundancy,omitempty"` +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultusage.go b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultusage.go new file mode 100644 index 00000000000..296e2fb8f99 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/model_vaultusage.go @@ -0,0 +1,31 @@ +package vaults + +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 VaultUsage struct { + CurrentValue *int64 `json:"currentValue,omitempty"` + Limit *int64 `json:"limit,omitempty"` + Name *NameInfo `json:"name,omitempty"` + NextResetTime *string `json:"nextResetTime,omitempty"` + QuotaPeriod *string `json:"quotaPeriod,omitempty"` + Unit *UsagesUnit `json:"unit,omitempty"` +} + +func (o *VaultUsage) GetNextResetTimeAsTime() (*time.Time, error) { + if o.NextResetTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.NextResetTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VaultUsage) SetNextResetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.NextResetTime = &formatted +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/predicates.go b/resource-manager/recoveryservices/2025-08-01/vaults/predicates.go new file mode 100644 index 00000000000..5e614d72f8d --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/predicates.go @@ -0,0 +1,93 @@ +package vaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicationUsageOperationPredicate struct { + ProtectedItemCount *int64 + RecoveryPlanCount *int64 + RecoveryServicesProviderAuthType *int64 + RegisteredServersCount *int64 +} + +func (p ReplicationUsageOperationPredicate) Matches(input ReplicationUsage) bool { + + if p.ProtectedItemCount != nil && (input.ProtectedItemCount == nil || *p.ProtectedItemCount != *input.ProtectedItemCount) { + return false + } + + if p.RecoveryPlanCount != nil && (input.RecoveryPlanCount == nil || *p.RecoveryPlanCount != *input.RecoveryPlanCount) { + return false + } + + if p.RecoveryServicesProviderAuthType != nil && (input.RecoveryServicesProviderAuthType == nil || *p.RecoveryServicesProviderAuthType != *input.RecoveryServicesProviderAuthType) { + return false + } + + if p.RegisteredServersCount != nil && (input.RegisteredServersCount == nil || *p.RegisteredServersCount != *input.RegisteredServersCount) { + return false + } + + return true +} + +type VaultOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VaultOperationPredicate) Matches(input Vault) bool { + + if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { + return false + } + + 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 VaultUsageOperationPredicate struct { + CurrentValue *int64 + Limit *int64 + NextResetTime *string + QuotaPeriod *string +} + +func (p VaultUsageOperationPredicate) Matches(input VaultUsage) bool { + + if p.CurrentValue != nil && (input.CurrentValue == nil || *p.CurrentValue != *input.CurrentValue) { + return false + } + + if p.Limit != nil && (input.Limit == nil || *p.Limit != *input.Limit) { + return false + } + + if p.NextResetTime != nil && (input.NextResetTime == nil || *p.NextResetTime != *input.NextResetTime) { + return false + } + + if p.QuotaPeriod != nil && (input.QuotaPeriod == nil || *p.QuotaPeriod != *input.QuotaPeriod) { + return false + } + + return true +} diff --git a/resource-manager/recoveryservices/2025-08-01/vaults/version.go b/resource-manager/recoveryservices/2025-08-01/vaults/version.go new file mode 100644 index 00000000000..699e778c994 --- /dev/null +++ b/resource-manager/recoveryservices/2025-08-01/vaults/version.go @@ -0,0 +1,10 @@ +package vaults + +// 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-08-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/vaults/2025-08-01" +} diff --git a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go index 6a8923d264f..1c3fd85652e 100644 --- a/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-02-01/backupprotectableitems/model_errordetail.go @@ -4,9 +4,7 @@ package backupprotectableitems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - 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"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,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 6a8923d264f..1c3fd85652e 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectableitems/model_errordetail.go @@ -4,9 +4,7 @@ package backupprotectableitems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - 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"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,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 deleted file mode 100644 index 6d8100b64e9..00000000000 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_erroradditionalinfo.go +++ /dev/null @@ -1,9 +0,0 @@ -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 01bc67ec3f4..86008b3edcb 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/backupprotectioncontainers/model_errordetail.go @@ -4,9 +4,7 @@ package backupprotectioncontainers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - 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"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,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 aed79a5ae3b..2c609c87024 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/operation/model_errordetail.go @@ -4,9 +4,7 @@ package operation // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - 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"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,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 cbf15d6fb2c..e3fa04c50a3 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/protecteditems/model_errordetail.go @@ -4,9 +4,7 @@ package protecteditems // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - 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"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,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 44feb059e5d..6eac856c404 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/protectioncontainers/model_errordetail.go @@ -4,9 +4,7 @@ package protectioncontainers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - 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"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,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 017103a66c3..b76617c0e57 100644 --- a/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_errordetail.go +++ b/resource-manager/recoveryservicesbackup/2025-08-01/softdeletedcontainers/model_errordetail.go @@ -4,9 +4,7 @@ package softdeletedcontainers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type ErrorDetail struct { - 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"` + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Recommendations *[]string `json:"recommendations,omitempty"` } diff --git a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignment.go b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignment.go index 6caa7fbc508..7a3791c9374 100644 --- a/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignment.go +++ b/resource-manager/redisenterprise/2025-07-01/accesspolicyassignments/model_accesspolicyassignment.go @@ -1,5 +1,9 @@ package accesspolicyassignments +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. @@ -7,5 +11,6 @@ type AccessPolicyAssignment struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Properties *AccessPolicyAssignmentProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Type *string `json:"type,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 index fd4718ad413..a87ffb93b55 100644 --- a/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignment.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_accesspolicyassignment.go @@ -1,5 +1,9 @@ package databases +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. @@ -7,5 +11,6 @@ type AccessPolicyAssignment struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Properties *AccessPolicyAssignmentProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Type *string `json:"type,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 index 0cdd07cc118..62c25515d4c 100644 --- a/resource-manager/redisenterprise/2025-07-01/databases/model_database.go +++ b/resource-manager/redisenterprise/2025-07-01/databases/model_database.go @@ -1,5 +1,9 @@ package databases +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. @@ -7,5 +11,6 @@ type Database struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Properties *DatabaseCreateProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Type *string `json:"type,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 index fde7f4db0fc..977fe056fe3 100644 --- a/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnection.go +++ b/resource-manager/redisenterprise/2025-07-01/privateendpointconnections/model_privateendpointconnection.go @@ -1,5 +1,9 @@ package privateendpointconnections +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. @@ -7,5 +11,6 @@ type PrivateEndpointConnection struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Type *string `json:"type,omitempty"` } diff --git a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresource.go b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresource.go index 69e8ae0e57a..6e8c3d8148b 100644 --- a/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresource.go +++ b/resource-manager/redisenterprise/2025-07-01/privatelinkresources/model_privatelinkresource.go @@ -1,5 +1,9 @@ package privatelinkresources +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. @@ -7,5 +11,6 @@ type PrivateLinkResource struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Type *string `json:"type,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 index 5da2f77534d..12beb91b747 100644 --- a/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnection.go +++ b/resource-manager/redisenterprise/2025-07-01/redisenterprise/model_privateendpointconnection.go @@ -1,5 +1,9 @@ package redisenterprise +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. @@ -7,5 +11,6 @@ type PrivateEndpointConnection struct { Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` Type *string `json:"type,omitempty"` }