From 42c33239f873337b534c144471eb13e6d351e2e7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 26 May 2022 20:20:39 +0000 Subject: [PATCH] CodeGen from PR 19170 in Azure/azure-rest-api-specs Merge 41d96e69810c8857cd5736d35890faccd5e27029 into bdbaa4582924baa7c90599a596c9e1f537e5c9c0 --- .../automanage/CHANGELOG.md | 2 +- .../2020-06-30-preview/automanage/_meta.json | 2 +- .../2020-06-30-preview/automanage/accounts.go | 15 +- .../configurationprofileassignments.go | 12 +- .../configurationprofilepreferences.go | 15 +- .../2020-06-30-preview/automanage/models.go | 5 +- .../automanage/CHANGELOG.md | 92 +++++- .../2021-04-30-preview/automanage/_meta.json | 2 +- .../automanage/automanageapi/interfaces.go | 45 +++ .../configurationprofileassignments.go | 255 +++++++++++++++ .../configurationprofilehciassignments.go | 299 ++++++++++++++++++ .../configurationprofilehcrpassignments.go | 299 ++++++++++++++++++ .../automanage/hcireports.go | 208 ++++++++++++ .../automanage/hcrpreports.go | 208 ++++++++++++ .../2021-04-30-preview/automanage/models.go | 110 ++++++- .../automanage/serviceprincipals.go | 187 +++++++++++ 16 files changed, 1718 insertions(+), 38 deletions(-) create mode 100644 services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehciassignments.go create mode 100644 services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehcrpassignments.go create mode 100644 services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcireports.go create mode 100644 services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcrpreports.go create mode 100644 services/preview/automanage/mgmt/2021-04-30-preview/automanage/serviceprincipals.go diff --git a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/CHANGELOG.md b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/CHANGELOG.md +++ b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/_meta.json b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/_meta.json index a0732504b587..9b316d63c048 100644 --- a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/_meta.json +++ b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "009295000e89e9a5879e614e043911d319e2512a", "readme": "/_/azure-rest-api-specs/specification/automanage/resource-manager/readme.md", "tag": "package-2020-06-30-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/accounts.go b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/accounts.go index 0252b600ce8a..df575980eaaf 100644 --- a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/accounts.go +++ b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/accounts.go @@ -52,8 +52,7 @@ func (client AccountsClient) CreateOrUpdate(ctx context.Context, accountName str Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.AccountsClient", "CreateOrUpdate", err.Error()) } @@ -138,8 +137,7 @@ func (client AccountsClient) Delete(ctx context.Context, resourceGroupName strin if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.AccountsClient", "Delete", err.Error()) @@ -225,8 +223,7 @@ func (client AccountsClient) Get(ctx context.Context, accountName string, resour Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.AccountsClient", "Get", err.Error()) } @@ -310,8 +307,7 @@ func (client AccountsClient) ListByResourceGroup(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.AccountsClient", "ListByResourceGroup", err.Error()) } @@ -473,8 +469,7 @@ func (client AccountsClient) Update(ctx context.Context, accountName string, res Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.AccountsClient", "Update", err.Error()) } diff --git a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofileassignments.go b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofileassignments.go index 2ffabf5175a9..7edc0175975a 100644 --- a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofileassignments.go +++ b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofileassignments.go @@ -55,8 +55,7 @@ func (client ConfigurationProfileAssignmentsClient) CreateOrUpdate(ctx context.C Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfileAssignmentsClient", "CreateOrUpdate", err.Error()) } @@ -146,8 +145,7 @@ func (client ConfigurationProfileAssignmentsClient) Delete(ctx context.Context, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfileAssignmentsClient", "Delete", err.Error()) @@ -233,8 +231,7 @@ func (client ConfigurationProfileAssignmentsClient) Get(ctx context.Context, res if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfileAssignmentsClient", "Get", err.Error()) @@ -319,8 +316,7 @@ func (client ConfigurationProfileAssignmentsClient) List(ctx context.Context, re if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfileAssignmentsClient", "List", err.Error()) diff --git a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofilepreferences.go b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofilepreferences.go index f238bb5b0676..3338906a7231 100644 --- a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofilepreferences.go +++ b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/configurationprofilepreferences.go @@ -53,8 +53,7 @@ func (client ConfigurationProfilePreferencesClient) CreateOrUpdate(ctx context.C Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfilePreferencesClient", "CreateOrUpdate", err.Error()) } @@ -139,8 +138,7 @@ func (client ConfigurationProfilePreferencesClient) Delete(ctx context.Context, if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: client.SubscriptionID, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfilePreferencesClient", "Delete", err.Error()) @@ -226,8 +224,7 @@ func (client ConfigurationProfilePreferencesClient) Get(ctx context.Context, con Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfilePreferencesClient", "Get", err.Error()) } @@ -311,8 +308,7 @@ func (client ConfigurationProfilePreferencesClient) ListByResourceGroup(ctx cont Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfilePreferencesClient", "ListByResourceGroup", err.Error()) } @@ -474,8 +470,7 @@ func (client ConfigurationProfilePreferencesClient) Update(ctx context.Context, Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("automanage.ConfigurationProfilePreferencesClient", "Update", err.Error()) } diff --git a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/models.go b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/models.go index ab407e4bbb3a..9b45e5f2037a 100644 --- a/services/preview/automanage/mgmt/2020-06-30-preview/automanage/models.go +++ b/services/preview/automanage/mgmt/2020-06-30-preview/automanage/models.go @@ -477,8 +477,8 @@ type OperationProperties struct { StatusCode *string `json:"statusCode,omitempty"` } -// ProxyResource the resource model definition for an Azure Resource Manager proxy resource. It will have -// everything other than required location and tags +// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not +// have tags and a location type ProxyResource struct { // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` @@ -511,6 +511,7 @@ func (r Resource) MarshalJSON() ([]byte, error) { } // TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource +// which has 'tags' and a 'location' type TrackedResource struct { // Tags - Resource tags. Tags map[string]*string `json:"tags"` diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/CHANGELOG.md b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/CHANGELOG.md index 52911e4cc5e4..61390066c988 100644 --- a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/CHANGELOG.md +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/CHANGELOG.md @@ -1,2 +1,92 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. *ServicePrincipal.UnmarshalJSON([]byte) error +1. ConfigurationProfileAssignmentsClient.ListByClusterName(context.Context, string, string) (ConfigurationProfileAssignmentList, error) +1. ConfigurationProfileAssignmentsClient.ListByClusterNamePreparer(context.Context, string, string) (*http.Request, error) +1. ConfigurationProfileAssignmentsClient.ListByClusterNameResponder(*http.Response) (ConfigurationProfileAssignmentList, error) +1. ConfigurationProfileAssignmentsClient.ListByClusterNameSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileAssignmentsClient.ListByMachineName(context.Context, string, string) (ConfigurationProfileAssignmentList, error) +1. ConfigurationProfileAssignmentsClient.ListByMachineNamePreparer(context.Context, string, string) (*http.Request, error) +1. ConfigurationProfileAssignmentsClient.ListByMachineNameResponder(*http.Response) (ConfigurationProfileAssignmentList, error) +1. ConfigurationProfileAssignmentsClient.ListByMachineNameSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileAssignmentsClient.ListByVirtualMachines(context.Context, string, string) (ConfigurationProfileAssignmentList, error) +1. ConfigurationProfileAssignmentsClient.ListByVirtualMachinesPreparer(context.Context, string, string) (*http.Request, error) +1. ConfigurationProfileAssignmentsClient.ListByVirtualMachinesResponder(*http.Response) (ConfigurationProfileAssignmentList, error) +1. ConfigurationProfileAssignmentsClient.ListByVirtualMachinesSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileHCIAssignmentsClient.CreateOrUpdate(context.Context, ConfigurationProfileAssignment, string, string, string) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCIAssignmentsClient.CreateOrUpdatePreparer(context.Context, ConfigurationProfileAssignment, string, string, string) (*http.Request, error) +1. ConfigurationProfileHCIAssignmentsClient.CreateOrUpdateResponder(*http.Response) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCIAssignmentsClient.CreateOrUpdateSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileHCIAssignmentsClient.Delete(context.Context, string, string, string) (autorest.Response, error) +1. ConfigurationProfileHCIAssignmentsClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. ConfigurationProfileHCIAssignmentsClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. ConfigurationProfileHCIAssignmentsClient.DeleteSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileHCIAssignmentsClient.Get(context.Context, string, string, string) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCIAssignmentsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. ConfigurationProfileHCIAssignmentsClient.GetResponder(*http.Response) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCIAssignmentsClient.GetSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileHCRPAssignmentsClient.CreateOrUpdate(context.Context, ConfigurationProfileAssignment, string, string, string) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCRPAssignmentsClient.CreateOrUpdatePreparer(context.Context, ConfigurationProfileAssignment, string, string, string) (*http.Request, error) +1. ConfigurationProfileHCRPAssignmentsClient.CreateOrUpdateResponder(*http.Response) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCRPAssignmentsClient.CreateOrUpdateSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileHCRPAssignmentsClient.Delete(context.Context, string, string, string) (autorest.Response, error) +1. ConfigurationProfileHCRPAssignmentsClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. ConfigurationProfileHCRPAssignmentsClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. ConfigurationProfileHCRPAssignmentsClient.DeleteSender(*http.Request) (*http.Response, error) +1. ConfigurationProfileHCRPAssignmentsClient.Get(context.Context, string, string, string) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCRPAssignmentsClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. ConfigurationProfileHCRPAssignmentsClient.GetResponder(*http.Response) (ConfigurationProfileAssignment, error) +1. ConfigurationProfileHCRPAssignmentsClient.GetSender(*http.Request) (*http.Response, error) +1. HCIReportsClient.Get(context.Context, string, string, string, string) (Report, error) +1. HCIReportsClient.GetPreparer(context.Context, string, string, string, string) (*http.Request, error) +1. HCIReportsClient.GetResponder(*http.Response) (Report, error) +1. HCIReportsClient.GetSender(*http.Request) (*http.Response, error) +1. HCIReportsClient.ListByConfigurationProfileAssignments(context.Context, string, string, string) (ReportList, error) +1. HCIReportsClient.ListByConfigurationProfileAssignmentsPreparer(context.Context, string, string, string) (*http.Request, error) +1. HCIReportsClient.ListByConfigurationProfileAssignmentsResponder(*http.Response) (ReportList, error) +1. HCIReportsClient.ListByConfigurationProfileAssignmentsSender(*http.Request) (*http.Response, error) +1. HCRPReportsClient.Get(context.Context, string, string, string, string) (Report, error) +1. HCRPReportsClient.GetPreparer(context.Context, string, string, string, string) (*http.Request, error) +1. HCRPReportsClient.GetResponder(*http.Response) (Report, error) +1. HCRPReportsClient.GetSender(*http.Request) (*http.Response, error) +1. HCRPReportsClient.ListByConfigurationProfileAssignments(context.Context, string, string, string) (ReportList, error) +1. HCRPReportsClient.ListByConfigurationProfileAssignmentsPreparer(context.Context, string, string, string) (*http.Request, error) +1. HCRPReportsClient.ListByConfigurationProfileAssignmentsResponder(*http.Response) (ReportList, error) +1. HCRPReportsClient.ListByConfigurationProfileAssignmentsSender(*http.Request) (*http.Response, error) +1. NewConfigurationProfileHCIAssignmentsClient(string) ConfigurationProfileHCIAssignmentsClient +1. NewConfigurationProfileHCIAssignmentsClientWithBaseURI(string, string) ConfigurationProfileHCIAssignmentsClient +1. NewConfigurationProfileHCRPAssignmentsClient(string) ConfigurationProfileHCRPAssignmentsClient +1. NewConfigurationProfileHCRPAssignmentsClientWithBaseURI(string, string) ConfigurationProfileHCRPAssignmentsClient +1. NewHCIReportsClient(string) HCIReportsClient +1. NewHCIReportsClientWithBaseURI(string, string) HCIReportsClient +1. NewHCRPReportsClient(string) HCRPReportsClient +1. NewHCRPReportsClientWithBaseURI(string, string) HCRPReportsClient +1. NewServicePrincipalsClient(string) ServicePrincipalsClient +1. NewServicePrincipalsClientWithBaseURI(string, string) ServicePrincipalsClient +1. ServicePrincipal.MarshalJSON() ([]byte, error) +1. ServicePrincipalProperties.MarshalJSON() ([]byte, error) +1. ServicePrincipalsClient.Get(context.Context) (ServicePrincipal, error) +1. ServicePrincipalsClient.GetPreparer(context.Context) (*http.Request, error) +1. ServicePrincipalsClient.GetResponder(*http.Response) (ServicePrincipal, error) +1. ServicePrincipalsClient.GetSender(*http.Request) (*http.Response, error) +1. ServicePrincipalsClient.ListBySubscription(context.Context) (ServicePrincipalListResult, error) +1. ServicePrincipalsClient.ListBySubscriptionPreparer(context.Context) (*http.Request, error) +1. ServicePrincipalsClient.ListBySubscriptionResponder(*http.Response) (ServicePrincipalListResult, error) +1. ServicePrincipalsClient.ListBySubscriptionSender(*http.Request) (*http.Response, error) + +### Struct Changes + +#### New Structs + +1. ConfigurationProfileHCIAssignmentsClient +1. ConfigurationProfileHCRPAssignmentsClient +1. HCIReportsClient +1. HCRPReportsClient +1. ServicePrincipal +1. ServicePrincipalListResult +1. ServicePrincipalProperties +1. ServicePrincipalsClient diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/_meta.json b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/_meta.json index 026e881b0872..4c37b149af97 100644 --- a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/_meta.json +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/_meta.json @@ -1,5 +1,5 @@ { - "commit": "d600759c3516b61a7c353bc8682bccbab85a6f65", + "commit": "009295000e89e9a5879e614e043911d319e2512a", "readme": "/_/azure-rest-api-specs/specification/automanage/resource-manager/readme.md", "tag": "package-2021-04-30-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/automanageapi/interfaces.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/automanageapi/interfaces.go index 136ca2ffe0a1..9b49b499ba83 100644 --- a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/automanageapi/interfaces.go +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/automanageapi/interfaces.go @@ -57,7 +57,10 @@ type ConfigurationProfileAssignmentsClientAPI interface { Delete(ctx context.Context, resourceGroupName string, configurationProfileAssignmentName string, VMName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, configurationProfileAssignmentName string, VMName string) (result automanage.ConfigurationProfileAssignment, err error) List(ctx context.Context, resourceGroupName string) (result automanage.ConfigurationProfileAssignmentList, err error) + ListByClusterName(ctx context.Context, resourceGroupName string, clusterName string) (result automanage.ConfigurationProfileAssignmentList, err error) + ListByMachineName(ctx context.Context, resourceGroupName string, machineName string) (result automanage.ConfigurationProfileAssignmentList, err error) ListBySubscription(ctx context.Context) (result automanage.ConfigurationProfileAssignmentList, err error) + ListByVirtualMachines(ctx context.Context, resourceGroupName string, VMName string) (result automanage.ConfigurationProfileAssignmentList, err error) } var _ ConfigurationProfileAssignmentsClientAPI = (*automanage.ConfigurationProfileAssignmentsClient)(nil) @@ -76,3 +79,45 @@ type ReportsClientAPI interface { } var _ ReportsClientAPI = (*automanage.ReportsClient)(nil) + +// ServicePrincipalsClientAPI contains the set of methods on the ServicePrincipalsClient type. +type ServicePrincipalsClientAPI interface { + Get(ctx context.Context) (result automanage.ServicePrincipal, err error) + ListBySubscription(ctx context.Context) (result automanage.ServicePrincipalListResult, err error) +} + +var _ ServicePrincipalsClientAPI = (*automanage.ServicePrincipalsClient)(nil) + +// ConfigurationProfileHCRPAssignmentsClientAPI contains the set of methods on the ConfigurationProfileHCRPAssignmentsClient type. +type ConfigurationProfileHCRPAssignmentsClientAPI interface { + CreateOrUpdate(ctx context.Context, parameters automanage.ConfigurationProfileAssignment, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result automanage.ConfigurationProfileAssignment, err error) + Delete(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result automanage.ConfigurationProfileAssignment, err error) +} + +var _ ConfigurationProfileHCRPAssignmentsClientAPI = (*automanage.ConfigurationProfileHCRPAssignmentsClient)(nil) + +// HCRPReportsClientAPI contains the set of methods on the HCRPReportsClient type. +type HCRPReportsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string, reportName string) (result automanage.Report, err error) + ListByConfigurationProfileAssignments(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result automanage.ReportList, err error) +} + +var _ HCRPReportsClientAPI = (*automanage.HCRPReportsClient)(nil) + +// ConfigurationProfileHCIAssignmentsClientAPI contains the set of methods on the ConfigurationProfileHCIAssignmentsClient type. +type ConfigurationProfileHCIAssignmentsClientAPI interface { + CreateOrUpdate(ctx context.Context, parameters automanage.ConfigurationProfileAssignment, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result automanage.ConfigurationProfileAssignment, err error) + Delete(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result automanage.ConfigurationProfileAssignment, err error) +} + +var _ ConfigurationProfileHCIAssignmentsClientAPI = (*automanage.ConfigurationProfileHCIAssignmentsClient)(nil) + +// HCIReportsClientAPI contains the set of methods on the HCIReportsClient type. +type HCIReportsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, reportName string) (result automanage.Report, err error) + ListByConfigurationProfileAssignments(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result automanage.ReportList, err error) +} + +var _ HCIReportsClientAPI = (*automanage.HCIReportsClient)(nil) diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofileassignments.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofileassignments.go index 3d7c42c59654..127ecf77dfd0 100644 --- a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofileassignments.go +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofileassignments.go @@ -380,6 +380,176 @@ func (client ConfigurationProfileAssignmentsClient) ListResponder(resp *http.Res return } +// ListByClusterName get list of configuration profile assignments +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the Arc machine. +func (client ConfigurationProfileAssignmentsClient) ListByClusterName(ctx context.Context, resourceGroupName string, clusterName string) (result ConfigurationProfileAssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileAssignmentsClient.ListByClusterName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileAssignmentsClient", "ListByClusterName", err.Error()) + } + + req, err := client.ListByClusterNamePreparer(ctx, resourceGroupName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByClusterName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByClusterNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByClusterName", resp, "Failure sending request") + return + } + + result, err = client.ListByClusterNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByClusterName", resp, "Failure responding to request") + return + } + + return +} + +// ListByClusterNamePreparer prepares the ListByClusterName request. +func (client ConfigurationProfileAssignmentsClient) ListByClusterNamePreparer(ctx context.Context, resourceGroupName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByClusterNameSender sends the ListByClusterName request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileAssignmentsClient) ListByClusterNameSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByClusterNameResponder handles the response to the ListByClusterName request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileAssignmentsClient) ListByClusterNameResponder(resp *http.Response) (result ConfigurationProfileAssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByMachineName get list of configuration profile assignments +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// machineName - the name of the Arc machine. +func (client ConfigurationProfileAssignmentsClient) ListByMachineName(ctx context.Context, resourceGroupName string, machineName string) (result ConfigurationProfileAssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileAssignmentsClient.ListByMachineName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileAssignmentsClient", "ListByMachineName", err.Error()) + } + + req, err := client.ListByMachineNamePreparer(ctx, resourceGroupName, machineName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByMachineName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByMachineNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByMachineName", resp, "Failure sending request") + return + } + + result, err = client.ListByMachineNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByMachineName", resp, "Failure responding to request") + return + } + + return +} + +// ListByMachineNamePreparer prepares the ListByMachineName request. +func (client ConfigurationProfileAssignmentsClient) ListByMachineNamePreparer(ctx context.Context, resourceGroupName string, machineName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByMachineNameSender sends the ListByMachineName request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileAssignmentsClient) ListByMachineNameSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByMachineNameResponder handles the response to the ListByMachineName request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileAssignmentsClient) ListByMachineNameResponder(resp *http.Response) (result ConfigurationProfileAssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListBySubscription get list of configuration profile assignments under a given subscription func (client ConfigurationProfileAssignmentsClient) ListBySubscription(ctx context.Context) (result ConfigurationProfileAssignmentList, err error) { if tracing.IsEnabled() { @@ -456,3 +626,88 @@ func (client ConfigurationProfileAssignmentsClient) ListBySubscriptionResponder( result.Response = autorest.Response{Response: resp} return } + +// ListByVirtualMachines get list of configuration profile assignments +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// VMName - the name of the virtual machine. +func (client ConfigurationProfileAssignmentsClient) ListByVirtualMachines(ctx context.Context, resourceGroupName string, VMName string) (result ConfigurationProfileAssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileAssignmentsClient.ListByVirtualMachines") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileAssignmentsClient", "ListByVirtualMachines", err.Error()) + } + + req, err := client.ListByVirtualMachinesPreparer(ctx, resourceGroupName, VMName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByVirtualMachines", nil, "Failure preparing request") + return + } + + resp, err := client.ListByVirtualMachinesSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByVirtualMachines", resp, "Failure sending request") + return + } + + result, err = client.ListByVirtualMachinesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileAssignmentsClient", "ListByVirtualMachines", resp, "Failure responding to request") + return + } + + return +} + +// ListByVirtualMachinesPreparer prepares the ListByVirtualMachines request. +func (client ConfigurationProfileAssignmentsClient) ListByVirtualMachinesPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmName": autorest.Encode("path", VMName), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.Automanage/configurationProfileAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByVirtualMachinesSender sends the ListByVirtualMachines request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileAssignmentsClient) ListByVirtualMachinesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByVirtualMachinesResponder handles the response to the ListByVirtualMachines request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileAssignmentsClient) ListByVirtualMachinesResponder(resp *http.Response) (result ConfigurationProfileAssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehciassignments.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehciassignments.go new file mode 100644 index 000000000000..2e9c65240961 --- /dev/null +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehciassignments.go @@ -0,0 +1,299 @@ +package automanage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ConfigurationProfileHCIAssignmentsClient is the automanage Client +type ConfigurationProfileHCIAssignmentsClient struct { + BaseClient +} + +// NewConfigurationProfileHCIAssignmentsClient creates an instance of the ConfigurationProfileHCIAssignmentsClient +// client. +func NewConfigurationProfileHCIAssignmentsClient(subscriptionID string) ConfigurationProfileHCIAssignmentsClient { + return NewConfigurationProfileHCIAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigurationProfileHCIAssignmentsClientWithBaseURI creates an instance of the +// ConfigurationProfileHCIAssignmentsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewConfigurationProfileHCIAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationProfileHCIAssignmentsClient { + return ConfigurationProfileHCIAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates an association between a AzureStackHCI cluster and Automanage configuration profile +// Parameters: +// parameters - parameters supplied to the create or update configuration profile assignment. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the Arc machine. +// configurationProfileAssignmentName - name of the configuration profile assignment. Only default is +// supported. +func (client ConfigurationProfileHCIAssignmentsClient) CreateOrUpdate(ctx context.Context, parameters ConfigurationProfileAssignment, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result ConfigurationProfileAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileHCIAssignmentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileHCIAssignmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, resourceGroupName, clusterName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConfigurationProfileHCIAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, parameters ConfigurationProfileAssignment, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileHCIAssignmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileHCIAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ConfigurationProfileAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a configuration profile assignment +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the Arc machine. +// configurationProfileAssignmentName - name of the configuration profile assignment +func (client ConfigurationProfileHCIAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileHCIAssignmentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileHCIAssignmentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConfigurationProfileHCIAssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileHCIAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileHCIAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get information about a configuration profile assignment +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the Arc machine. +// configurationProfileAssignmentName - the configuration profile assignment name. +func (client ConfigurationProfileHCIAssignmentsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result ConfigurationProfileAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileHCIAssignmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileHCIAssignmentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCIAssignmentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationProfileHCIAssignmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileHCIAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileHCIAssignmentsClient) GetResponder(resp *http.Response) (result ConfigurationProfileAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehcrpassignments.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehcrpassignments.go new file mode 100644 index 000000000000..3de43b657ad4 --- /dev/null +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/configurationprofilehcrpassignments.go @@ -0,0 +1,299 @@ +package automanage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ConfigurationProfileHCRPAssignmentsClient is the automanage Client +type ConfigurationProfileHCRPAssignmentsClient struct { + BaseClient +} + +// NewConfigurationProfileHCRPAssignmentsClient creates an instance of the ConfigurationProfileHCRPAssignmentsClient +// client. +func NewConfigurationProfileHCRPAssignmentsClient(subscriptionID string) ConfigurationProfileHCRPAssignmentsClient { + return NewConfigurationProfileHCRPAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewConfigurationProfileHCRPAssignmentsClientWithBaseURI creates an instance of the +// ConfigurationProfileHCRPAssignmentsClient client using a custom endpoint. Use this when interacting with an Azure +// cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewConfigurationProfileHCRPAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) ConfigurationProfileHCRPAssignmentsClient { + return ConfigurationProfileHCRPAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates an association between a ARC machine and Automanage configuration profile +// Parameters: +// parameters - parameters supplied to the create or update configuration profile assignment. +// resourceGroupName - the name of the resource group. The name is case insensitive. +// machineName - the name of the Arc machine. +// configurationProfileAssignmentName - name of the configuration profile assignment. Only default is +// supported. +func (client ConfigurationProfileHCRPAssignmentsClient) CreateOrUpdate(ctx context.Context, parameters ConfigurationProfileAssignment, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result ConfigurationProfileAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileHCRPAssignmentsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileHCRPAssignmentsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, parameters, resourceGroupName, machineName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ConfigurationProfileHCRPAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, parameters ConfigurationProfileAssignment, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileHCRPAssignmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileHCRPAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result ConfigurationProfileAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a configuration profile assignment +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// machineName - the name of the Arc machine. +// configurationProfileAssignmentName - name of the configuration profile assignment +func (client ConfigurationProfileHCRPAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileHCRPAssignmentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileHCRPAssignmentsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, machineName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ConfigurationProfileHCRPAssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileHCRPAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileHCRPAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get information about a configuration profile assignment +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// machineName - the name of the Arc machine. +// configurationProfileAssignmentName - the configuration profile assignment name. +func (client ConfigurationProfileHCRPAssignmentsClient) Get(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result ConfigurationProfileAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ConfigurationProfileHCRPAssignmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ConfigurationProfileHCRPAssignmentsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, machineName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ConfigurationProfileHCRPAssignmentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ConfigurationProfileHCRPAssignmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ConfigurationProfileHCRPAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ConfigurationProfileHCRPAssignmentsClient) GetResponder(resp *http.Response) (result ConfigurationProfileAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcireports.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcireports.go new file mode 100644 index 000000000000..320511383033 --- /dev/null +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcireports.go @@ -0,0 +1,208 @@ +package automanage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// HCIReportsClient is the automanage Client +type HCIReportsClient struct { + BaseClient +} + +// NewHCIReportsClient creates an instance of the HCIReportsClient client. +func NewHCIReportsClient(subscriptionID string) HCIReportsClient { + return NewHCIReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHCIReportsClientWithBaseURI creates an instance of the HCIReportsClient client using a custom endpoint. Use this +// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewHCIReportsClientWithBaseURI(baseURI string, subscriptionID string) HCIReportsClient { + return HCIReportsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get information about a report associated with a configuration profile assignment run +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the Arc machine. +// configurationProfileAssignmentName - the configuration profile assignment name. +// reportName - the report name. +func (client HCIReportsClient) Get(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, reportName string) (result Report, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HCIReportsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.HCIReportsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterName, configurationProfileAssignmentName, reportName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCIReportsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.HCIReportsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCIReportsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client HCIReportsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string, reportName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "reportName": autorest.Encode("path", reportName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HCIReportsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HCIReportsClient) GetResponder(resp *http.Response) (result Report, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByConfigurationProfileAssignments retrieve a list of reports within a given configuration profile assignment +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterName - the name of the Arc machine. +// configurationProfileAssignmentName - the configuration profile assignment name. +func (client HCIReportsClient) ListByConfigurationProfileAssignments(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (result ReportList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HCIReportsClient.ListByConfigurationProfileAssignments") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.HCIReportsClient", "ListByConfigurationProfileAssignments", err.Error()) + } + + req, err := client.ListByConfigurationProfileAssignmentsPreparer(ctx, resourceGroupName, clusterName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCIReportsClient", "ListByConfigurationProfileAssignments", nil, "Failure preparing request") + return + } + + resp, err := client.ListByConfigurationProfileAssignmentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.HCIReportsClient", "ListByConfigurationProfileAssignments", resp, "Failure sending request") + return + } + + result, err = client.ListByConfigurationProfileAssignmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCIReportsClient", "ListByConfigurationProfileAssignments", resp, "Failure responding to request") + return + } + + return +} + +// ListByConfigurationProfileAssignmentsPreparer prepares the ListByConfigurationProfileAssignments request. +func (client HCIReportsClient) ListByConfigurationProfileAssignmentsPreparer(ctx context.Context, resourceGroupName string, clusterName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHci/clusters/{clusterName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByConfigurationProfileAssignmentsSender sends the ListByConfigurationProfileAssignments request. The method will close the +// http.Response Body if it receives an error. +func (client HCIReportsClient) ListByConfigurationProfileAssignmentsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByConfigurationProfileAssignmentsResponder handles the response to the ListByConfigurationProfileAssignments request. The method always +// closes the http.Response Body. +func (client HCIReportsClient) ListByConfigurationProfileAssignmentsResponder(resp *http.Response) (result ReportList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcrpreports.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcrpreports.go new file mode 100644 index 000000000000..49453e50c342 --- /dev/null +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/hcrpreports.go @@ -0,0 +1,208 @@ +package automanage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// HCRPReportsClient is the automanage Client +type HCRPReportsClient struct { + BaseClient +} + +// NewHCRPReportsClient creates an instance of the HCRPReportsClient client. +func NewHCRPReportsClient(subscriptionID string) HCRPReportsClient { + return NewHCRPReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewHCRPReportsClientWithBaseURI creates an instance of the HCRPReportsClient client using a custom endpoint. Use +// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewHCRPReportsClientWithBaseURI(baseURI string, subscriptionID string) HCRPReportsClient { + return HCRPReportsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get information about a report associated with a configuration profile assignment run +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// machineName - the name of the Arc machine. +// configurationProfileAssignmentName - the configuration profile assignment name. +// reportName - the report name. +func (client HCRPReportsClient) Get(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string, reportName string) (result Report, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HCRPReportsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.HCRPReportsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, machineName, configurationProfileAssignmentName, reportName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCRPReportsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.HCRPReportsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCRPReportsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client HCRPReportsClient) GetPreparer(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string, reportName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "machineName": autorest.Encode("path", machineName), + "reportName": autorest.Encode("path", reportName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports/{reportName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client HCRPReportsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client HCRPReportsClient) GetResponder(resp *http.Response) (result Report, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByConfigurationProfileAssignments retrieve a list of reports within a given configuration profile assignment +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// machineName - the name of the Arc machine. +// configurationProfileAssignmentName - the configuration profile assignment name. +func (client HCRPReportsClient) ListByConfigurationProfileAssignments(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (result ReportList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/HCRPReportsClient.ListByConfigurationProfileAssignments") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.HCRPReportsClient", "ListByConfigurationProfileAssignments", err.Error()) + } + + req, err := client.ListByConfigurationProfileAssignmentsPreparer(ctx, resourceGroupName, machineName, configurationProfileAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCRPReportsClient", "ListByConfigurationProfileAssignments", nil, "Failure preparing request") + return + } + + resp, err := client.ListByConfigurationProfileAssignmentsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.HCRPReportsClient", "ListByConfigurationProfileAssignments", resp, "Failure sending request") + return + } + + result, err = client.ListByConfigurationProfileAssignmentsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.HCRPReportsClient", "ListByConfigurationProfileAssignments", resp, "Failure responding to request") + return + } + + return +} + +// ListByConfigurationProfileAssignmentsPreparer prepares the ListByConfigurationProfileAssignments request. +func (client HCRPReportsClient) ListByConfigurationProfileAssignmentsPreparer(ctx context.Context, resourceGroupName string, machineName string, configurationProfileAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "configurationProfileAssignmentName": autorest.Encode("path", configurationProfileAssignmentName), + "machineName": autorest.Encode("path", machineName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.Automanage/configurationProfileAssignments/{configurationProfileAssignmentName}/reports", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByConfigurationProfileAssignmentsSender sends the ListByConfigurationProfileAssignments request. The method will close the +// http.Response Body if it receives an error. +func (client HCRPReportsClient) ListByConfigurationProfileAssignmentsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByConfigurationProfileAssignmentsResponder handles the response to the ListByConfigurationProfileAssignments request. The method always +// closes the http.Response Body. +func (client HCRPReportsClient) ListByConfigurationProfileAssignmentsResponder(resp *http.Response) (result ReportList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/models.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/models.go index dcd020a00709..d38c283a6ab5 100644 --- a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/models.go +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/models.go @@ -230,7 +230,7 @@ type ConfigurationProfileAssignmentList struct { type ConfigurationProfileAssignmentProperties struct { // ConfigurationProfile - The Automanage configurationProfile ARM Resource URI. ConfigurationProfile *string `json:"configurationProfile,omitempty"` - // TargetID - The target VM resource URI + // TargetID - READ-ONLY; The target VM resource URI TargetID *string `json:"targetId,omitempty"` // Status - READ-ONLY; The status of onboarding, which only appears in the response. Status *string `json:"status,omitempty"` @@ -244,9 +244,6 @@ func (cpap ConfigurationProfileAssignmentProperties) MarshalJSON() ([]byte, erro if cpap.ConfigurationProfile != nil { objectMap["configurationProfile"] = cpap.ConfigurationProfile } - if cpap.TargetID != nil { - objectMap["targetId"] = cpap.TargetID - } if cpap.ProfileOverrides != nil { objectMap["profileOverrides"] = cpap.ProfileOverrides } @@ -530,6 +527,111 @@ func (r Resource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ServicePrincipal the Service Principal Id for the subscription. +type ServicePrincipal struct { + autorest.Response `json:"-"` + // ServicePrincipalProperties - The Service Principal properties for the subscription + *ServicePrincipalProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipal. +func (sp ServicePrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.ServicePrincipalProperties != nil { + objectMap["properties"] = sp.ServicePrincipalProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ServicePrincipal struct. +func (sp *ServicePrincipal) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var servicePrincipalProperties ServicePrincipalProperties + err = json.Unmarshal(*v, &servicePrincipalProperties) + if err != nil { + return err + } + sp.ServicePrincipalProperties = &servicePrincipalProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sp.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sp.Type = &typeVar + } + } + } + + return nil +} + +// ServicePrincipalListResult the list of ServicePrincipals. +type ServicePrincipalListResult struct { + autorest.Response `json:"-"` + // Value - The list of servicePrincipals. + Value *[]ServicePrincipal `json:"value,omitempty"` +} + +// ServicePrincipalProperties the Service Principal properties for the subscription. +type ServicePrincipalProperties struct { + // ServicePrincipalID - READ-ONLY; The Service Principal Id for the subscription. + ServicePrincipalID *string `json:"servicePrincipalId,omitempty"` + // AuthorizationSet - READ-ONLY; Returns the contributor RBAC Role exist or not for the Service Principal Id. + AuthorizationSet *bool `json:"authorizationSet,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalProperties. +func (spp ServicePrincipalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + // SystemData metadata pertaining to creation and last modification of the resource. type SystemData struct { // CreatedBy - The identity that created the resource. diff --git a/services/preview/automanage/mgmt/2021-04-30-preview/automanage/serviceprincipals.go b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/serviceprincipals.go new file mode 100644 index 000000000000..601b25e0c107 --- /dev/null +++ b/services/preview/automanage/mgmt/2021-04-30-preview/automanage/serviceprincipals.go @@ -0,0 +1,187 @@ +package automanage + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// ServicePrincipalsClient is the automanage Client +type ServicePrincipalsClient struct { + BaseClient +} + +// NewServicePrincipalsClient creates an instance of the ServicePrincipalsClient client. +func NewServicePrincipalsClient(subscriptionID string) ServicePrincipalsClient { + return NewServicePrincipalsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewServicePrincipalsClientWithBaseURI creates an instance of the ServicePrincipalsClient client using a custom +// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure +// stack). +func NewServicePrincipalsClientWithBaseURI(baseURI string, subscriptionID string) ServicePrincipalsClient { + return ServicePrincipalsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the Automanage AAD first party Application Service Principal details for the subscription id. +func (client ServicePrincipalsClient) Get(ctx context.Context) (result ServicePrincipal, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ServicePrincipalsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ServicePrincipalsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ServicePrincipalsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ServicePrincipalsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ServicePrincipalsClient) GetPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) GetResponder(resp *http.Response) (result ServicePrincipal, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListBySubscription get the Automanage AAD first party Application Service Principal details for the subscription id. +func (client ServicePrincipalsClient) ListBySubscription(ctx context.Context) (result ServicePrincipalListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ServicePrincipalsClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("automanage.ServicePrincipalsClient", "ListBySubscription", err.Error()) + } + + req, err := client.ListBySubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ServicePrincipalsClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automanage.ServicePrincipalsClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automanage.ServicePrincipalsClient", "ListBySubscription", resp, "Failure responding to request") + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client ServicePrincipalsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-04-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Automanage/servicePrincipals", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client ServicePrincipalsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client ServicePrincipalsClient) ListBySubscriptionResponder(resp *http.Response) (result ServicePrincipalListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}