diff --git a/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md b/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md index 52911e4cc5e4..e25e91f941d1 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md +++ b/services/appinsights/mgmt/2015-05-01/insights/CHANGELOG.md @@ -1,2 +1,13 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. ItemType.Folder + +## Additive Changes + +### New Constants + +1. ItemType.None diff --git a/services/appinsights/mgmt/2015-05-01/insights/_meta.json b/services/appinsights/mgmt/2015-05-01/insights/_meta.json index ce505b5da55f..c032cb7a8479 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/_meta.json +++ b/services/appinsights/mgmt/2015-05-01/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", "tag": "package-2015-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go b/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go index 4cc774485e47..2e08deb5b096 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go +++ b/services/appinsights/mgmt/2015-05-01/insights/analyticsitems.go @@ -55,8 +55,7 @@ func (client AnalyticsItemsClient) Delete(ctx context.Context, resourceGroupName 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("insights.AnalyticsItemsClient", "Delete", err.Error()) } @@ -151,8 +150,7 @@ func (client AnalyticsItemsClient) Get(ctx context.Context, resourceGroupName st 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("insights.AnalyticsItemsClient", "Get", err.Error()) } @@ -251,8 +249,7 @@ func (client AnalyticsItemsClient) List(ctx context.Context, resourceGroupName s 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("insights.AnalyticsItemsClient", "List", err.Error()) } @@ -357,8 +354,7 @@ func (client AnalyticsItemsClient) Put(ctx context.Context, resourceGroupName st 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("insights.AnalyticsItemsClient", "Put", err.Error()) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/annotations.go b/services/appinsights/mgmt/2015-05-01/insights/annotations.go index 44ba919dd8e0..aa31fd7d0e74 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/annotations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/annotations.go @@ -51,8 +51,7 @@ func (client AnnotationsClient) Create(ctx context.Context, resourceGroupName st 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("insights.AnnotationsClient", "Create", err.Error()) @@ -140,8 +139,7 @@ func (client AnnotationsClient) Delete(ctx context.Context, resourceGroupName st 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("insights.AnnotationsClient", "Delete", err.Error()) @@ -227,8 +225,7 @@ func (client AnnotationsClient) Get(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("insights.AnnotationsClient", "Get", err.Error()) @@ -316,8 +313,7 @@ func (client AnnotationsClient) List(ctx context.Context, resourceGroupName stri 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("insights.AnnotationsClient", "List", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go index c82caeeab8fa..ca33d3c4c68d 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go +++ b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go @@ -51,8 +51,7 @@ func (client APIKeysClient) Create(ctx context.Context, resourceGroupName string 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("insights.APIKeysClient", "Create", err.Error()) @@ -140,8 +139,7 @@ func (client APIKeysClient) Delete(ctx context.Context, resourceGroupName string 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("insights.APIKeysClient", "Delete", err.Error()) @@ -228,8 +226,7 @@ func (client APIKeysClient) Get(ctx context.Context, resourceGroupName string, r 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("insights.APIKeysClient", "Get", err.Error()) @@ -315,8 +312,7 @@ func (client APIKeysClient) List(ctx context.Context, resourceGroupName string, 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("insights.APIKeysClient", "List", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go index 7b824be297a7..997a483b327f 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go @@ -50,8 +50,7 @@ func (client ComponentAvailableFeaturesClient) Get(ctx context.Context, resource 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("insights.ComponentAvailableFeaturesClient", "Get", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go index 19a1ce42b190..3416a616be9c 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go @@ -50,8 +50,7 @@ func (client ComponentCurrentBillingFeaturesClient) 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("insights.ComponentCurrentBillingFeaturesClient", "Get", err.Error()) @@ -138,8 +137,7 @@ func (client ComponentCurrentBillingFeaturesClient) Update(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("insights.ComponentCurrentBillingFeaturesClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go index d4f7a3cc512e..0620681495e8 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go @@ -50,8 +50,7 @@ func (client ComponentFeatureCapabilitiesClient) Get(ctx context.Context, resour 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("insights.ComponentFeatureCapabilitiesClient", "Get", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go index 9a786872f5bc..98d79dda19cd 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go @@ -50,8 +50,7 @@ func (client ComponentQuotaStatusClient) Get(ctx context.Context, resourceGroupN 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("insights.ComponentQuotaStatusClient", "Get", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/components.go b/services/appinsights/mgmt/2015-05-01/insights/components.go index 4a7dab1e5367..687a6d6f6169 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/components.go +++ b/services/appinsights/mgmt/2015-05-01/insights/components.go @@ -51,8 +51,7 @@ func (client ComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroup 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}}}, {TargetValue: insightProperties, @@ -141,8 +140,7 @@ func (client ComponentsClient) Delete(ctx context.Context, resourceGroupName str 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("insights.ComponentsClient", "Delete", err.Error()) @@ -226,8 +224,7 @@ func (client ComponentsClient) Get(ctx context.Context, resourceGroupName string 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("insights.ComponentsClient", "Get", err.Error()) @@ -313,8 +310,7 @@ func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroup 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("insights.ComponentsClient", "GetPurgeStatus", err.Error()) @@ -518,8 +514,7 @@ func (client ComponentsClient) ListByResourceGroup(ctx context.Context, resource 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("insights.ComponentsClient", "ListByResourceGroup", err.Error()) @@ -651,8 +646,7 @@ func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName stri 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}}}, {TargetValue: body, @@ -743,8 +737,7 @@ func (client ComponentsClient) UpdateTags(ctx context.Context, resourceGroupName 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("insights.ComponentsClient", "UpdateTags", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/enums.go b/services/appinsights/mgmt/2015-05-01/insights/enums.go index 7e437a00e2b3..e9597f6b1844 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/enums.go +++ b/services/appinsights/mgmt/2015-05-01/insights/enums.go @@ -146,10 +146,10 @@ func PossibleItemScopePathValues() []ItemScopePath { type ItemType string const ( - // Folder ... - Folder ItemType = "folder" // Function ... Function ItemType = "function" + // None ... + None ItemType = "none" // Query ... Query ItemType = "query" // Recent ... @@ -158,7 +158,7 @@ const ( // PossibleItemTypeValues returns an array of possible values for the ItemType const type. func PossibleItemTypeValues() []ItemType { - return []ItemType{Folder, Function, Query, Recent} + return []ItemType{Function, None, Query, Recent} } // ItemTypeParameter enumerates the values for item type parameter. diff --git a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go index 668a155a8370..8543b8d411df 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go @@ -52,8 +52,7 @@ func (client ExportConfigurationsClient) Create(ctx context.Context, resourceGro 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("insights.ExportConfigurationsClient", "Create", err.Error()) @@ -141,8 +140,7 @@ func (client ExportConfigurationsClient) Delete(ctx context.Context, resourceGro 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("insights.ExportConfigurationsClient", "Delete", err.Error()) @@ -229,8 +227,7 @@ func (client ExportConfigurationsClient) Get(ctx context.Context, resourceGroupN 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("insights.ExportConfigurationsClient", "Get", err.Error()) @@ -316,8 +313,7 @@ func (client ExportConfigurationsClient) List(ctx context.Context, resourceGroup 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("insights.ExportConfigurationsClient", "List", err.Error()) @@ -404,8 +400,7 @@ func (client ExportConfigurationsClient) Update(ctx context.Context, resourceGro 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("insights.ExportConfigurationsClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorites.go b/services/appinsights/mgmt/2015-05-01/insights/favorites.go index 9edd56e83328..732fca754804 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/favorites.go +++ b/services/appinsights/mgmt/2015-05-01/insights/favorites.go @@ -52,8 +52,7 @@ func (client FavoritesClient) Add(ctx context.Context, resourceGroupName string, 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("insights.FavoritesClient", "Add", err.Error()) @@ -145,8 +144,7 @@ func (client FavoritesClient) Delete(ctx context.Context, resourceGroupName stri 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("insights.FavoritesClient", "Delete", err.Error()) @@ -232,8 +230,7 @@ func (client FavoritesClient) Get(ctx context.Context, resourceGroupName string, 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("insights.FavoritesClient", "Get", err.Error()) @@ -325,8 +322,7 @@ func (client FavoritesClient) List(ctx context.Context, resourceGroupName string 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("insights.FavoritesClient", "List", err.Error()) @@ -427,8 +423,7 @@ func (client FavoritesClient) Update(ctx context.Context, resourceGroupName stri 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("insights.FavoritesClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/models.go b/services/appinsights/mgmt/2015-05-01/insights/models.go index 4a23033075cf..e7a3295c3fe1 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/models.go +++ b/services/appinsights/mgmt/2015-05-01/insights/models.go @@ -196,7 +196,7 @@ type ApplicationInsightsComponentAnalyticsItem struct { Version *string `json:"Version,omitempty"` // Scope - Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'ItemScopeShared', 'ItemScopeUser' Scope ItemScope `json:"Scope,omitempty"` - // Type - Enum indicating the type of the Analytics item. Possible values include: 'Query', 'Function', 'Folder', 'Recent' + // Type - Enum indicating the type of the Analytics item. Possible values include: 'None', 'Query', 'Recent', 'Function' Type ItemType `json:"Type,omitempty"` // TimeCreated - READ-ONLY; Date and time in UTC when this item was created. TimeCreated *string `json:"TimeCreated,omitempty"` diff --git a/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go b/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go index 5110ff178a32..0f11b643e8bc 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go +++ b/services/appinsights/mgmt/2015-05-01/insights/myworkbooks.go @@ -52,8 +52,7 @@ func (client MyWorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGrou 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}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workbookProperties, Constraints: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, @@ -146,8 +145,7 @@ func (client MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName st 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("insights.MyWorkbooksClient", "Delete", err.Error()) } @@ -231,8 +229,7 @@ func (client MyWorkbooksClient) Get(ctx context.Context, resourceGroupName strin 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("insights.MyWorkbooksClient", "Get", err.Error()) } @@ -320,8 +317,7 @@ func (client MyWorkbooksClient) ListByResourceGroup(ctx context.Context, resourc 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("insights.MyWorkbooksClient", "ListByResourceGroup", err.Error()) } @@ -502,8 +498,7 @@ func (client MyWorkbooksClient) Update(ctx context.Context, resourceGroupName st 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("insights.MyWorkbooksClient", "Update", err.Error()) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go index 646c0107a4a4..78223d23395b 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go @@ -52,8 +52,7 @@ func (client ProactiveDetectionConfigurationsClient) Get(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("insights.ProactiveDetectionConfigurationsClient", "Get", err.Error()) @@ -139,8 +138,7 @@ func (client ProactiveDetectionConfigurationsClient) List(ctx context.Context, r 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("insights.ProactiveDetectionConfigurationsClient", "List", err.Error()) @@ -229,8 +227,7 @@ func (client ProactiveDetectionConfigurationsClient) Update(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("insights.ProactiveDetectionConfigurationsClient", "Update", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go index 84963a68379b..dcb3923ba146 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go @@ -50,8 +50,7 @@ func (client WebTestLocationsClient) List(ctx context.Context, resourceGroupName 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("insights.WebTestLocationsClient", "List", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtests.go b/services/appinsights/mgmt/2015-05-01/insights/webtests.go index 04768305c609..cb9450fdee91 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtests.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtests.go @@ -51,8 +51,7 @@ func (client WebTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupNa 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}}}, {TargetValue: webTestDefinition, @@ -147,8 +146,7 @@ func (client WebTestsClient) Delete(ctx context.Context, resourceGroupName strin 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("insights.WebTestsClient", "Delete", err.Error()) } @@ -230,8 +228,7 @@ func (client WebTestsClient) Get(ctx context.Context, resourceGroupName string, 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("insights.WebTestsClient", "Get", err.Error()) @@ -435,8 +432,7 @@ func (client WebTestsClient) ListByComponent(ctx context.Context, componentName 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("insights.WebTestsClient", "ListByComponent", err.Error()) @@ -562,8 +558,7 @@ func (client WebTestsClient) ListByResourceGroup(ctx context.Context, resourceGr 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("insights.WebTestsClient", "ListByResourceGroup", err.Error()) @@ -690,8 +685,7 @@ func (client WebTestsClient) UpdateTags(ctx context.Context, resourceGroupName s 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("insights.WebTestsClient", "UpdateTags", err.Error()) diff --git a/services/appinsights/mgmt/2015-05-01/insights/workbooks.go b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go index b11fc21428fd..e30bd2ce8bb4 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workbooks.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go @@ -52,8 +52,7 @@ func (client WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupN 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}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: workbookProperties, Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.Name", Name: validation.Null, Rule: true, Chain: nil}, @@ -148,8 +147,7 @@ func (client WorkbooksClient) Delete(ctx context.Context, resourceGroupName stri 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("insights.WorkbooksClient", "Delete", err.Error()) } @@ -233,8 +231,7 @@ func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, 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("insights.WorkbooksClient", "Get", err.Error()) } @@ -322,8 +319,7 @@ func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceG 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("insights.WorkbooksClient", "ListByResourceGroup", err.Error()) } @@ -415,8 +411,7 @@ func (client WorkbooksClient) Update(ctx context.Context, resourceGroupName stri 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("insights.WorkbooksClient", "Update", err.Error()) } diff --git a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go index 10c6e0ba0e4a..c46789bddc6e 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go @@ -52,8 +52,7 @@ func (client WorkItemConfigurationsClient) Create(ctx context.Context, resourceG 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("insights.WorkItemConfigurationsClient", "Create", err.Error()) @@ -142,8 +141,7 @@ func (client WorkItemConfigurationsClient) Delete(ctx context.Context, resourceG 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("insights.WorkItemConfigurationsClient", "Delete", err.Error()) @@ -228,8 +226,7 @@ func (client WorkItemConfigurationsClient) GetDefault(ctx context.Context, resou 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("insights.WorkItemConfigurationsClient", "GetDefault", err.Error()) @@ -316,8 +313,7 @@ func (client WorkItemConfigurationsClient) GetItem(ctx context.Context, resource 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("insights.WorkItemConfigurationsClient", "GetItem", err.Error()) @@ -403,8 +399,7 @@ func (client WorkItemConfigurationsClient) List(ctx context.Context, resourceGro 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("insights.WorkItemConfigurationsClient", "List", err.Error()) @@ -493,8 +488,7 @@ func (client WorkItemConfigurationsClient) UpdateItem(ctx context.Context, resou 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("insights.WorkItemConfigurationsClient", "UpdateItem", err.Error()) diff --git a/services/appinsights/mgmt/2020-02-02/insights/CHANGELOG.md b/services/appinsights/mgmt/2020-02-02/insights/CHANGELOG.md index 52911e4cc5e4..8d54f7adbc26 100644 --- a/services/appinsights/mgmt/2020-02-02/insights/CHANGELOG.md +++ b/services/appinsights/mgmt/2020-02-02/insights/CHANGELOG.md @@ -1,2 +1,13 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. ItemType.ItemTypeFolder + +## Additive Changes + +### New Constants + +1. ItemType.ItemTypeNone diff --git a/services/appinsights/mgmt/2020-02-02/insights/_meta.json b/services/appinsights/mgmt/2020-02-02/insights/_meta.json index 45894dd958ff..23c0336ebd0b 100644 --- a/services/appinsights/mgmt/2020-02-02/insights/_meta.json +++ b/services/appinsights/mgmt/2020-02-02/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "b47572ab2069865484c493a4f679d4e72f8b303d", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", "tag": "package-2020-02-02", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/appinsights/mgmt/2020-02-02/insights/enums.go b/services/appinsights/mgmt/2020-02-02/insights/enums.go index f1909b5bbfbc..097aea75ad83 100644 --- a/services/appinsights/mgmt/2020-02-02/insights/enums.go +++ b/services/appinsights/mgmt/2020-02-02/insights/enums.go @@ -146,10 +146,10 @@ func PossibleItemScopePathValues() []ItemScopePath { type ItemType string const ( - // ItemTypeFolder ... - ItemTypeFolder ItemType = "folder" // ItemTypeFunction ... ItemTypeFunction ItemType = "function" + // ItemTypeNone ... + ItemTypeNone ItemType = "none" // ItemTypeQuery ... ItemTypeQuery ItemType = "query" // ItemTypeRecent ... @@ -158,7 +158,7 @@ const ( // PossibleItemTypeValues returns an array of possible values for the ItemType const type. func PossibleItemTypeValues() []ItemType { - return []ItemType{ItemTypeFolder, ItemTypeFunction, ItemTypeQuery, ItemTypeRecent} + return []ItemType{ItemTypeFunction, ItemTypeNone, ItemTypeQuery, ItemTypeRecent} } // ItemTypeParameter enumerates the values for item type parameter. diff --git a/services/appinsights/mgmt/2020-02-02/insights/models.go b/services/appinsights/mgmt/2020-02-02/insights/models.go index b8d4af6e0655..c5d268f199a3 100644 --- a/services/appinsights/mgmt/2020-02-02/insights/models.go +++ b/services/appinsights/mgmt/2020-02-02/insights/models.go @@ -210,7 +210,7 @@ type ApplicationInsightsComponentAnalyticsItem struct { Version *string `json:"Version,omitempty"` // Scope - Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'ItemScopeShared', 'ItemScopeUser' Scope ItemScope `json:"Scope,omitempty"` - // Type - Enum indicating the type of the Analytics item. Possible values include: 'ItemTypeQuery', 'ItemTypeFunction', 'ItemTypeFolder', 'ItemTypeRecent' + // Type - Enum indicating the type of the Analytics item. Possible values include: 'ItemTypeNone', 'ItemTypeQuery', 'ItemTypeRecent', 'ItemTypeFunction' Type ItemType `json:"Type,omitempty"` // TimeCreated - READ-ONLY; Date and time in UTC when this item was created. TimeCreated *string `json:"TimeCreated,omitempty"` diff --git a/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md b/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md index 52911e4cc5e4..c1b6629a9798 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md +++ b/services/authorization/mgmt/2015-07-01/authorization/CHANGELOG.md @@ -1,2 +1,43 @@ -# Change History +# Unreleased +## Breaking Changes + +### Signature Changes + +#### Funcs + +1. ProviderOperationsMetadataClient.Get + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ProviderOperationsMetadataClient.GetPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ProviderOperationsMetadataClient.List + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ProviderOperationsMetadataClient.ListComplete + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ProviderOperationsMetadataClient.ListPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string + +## Additive Changes + +### New Funcs + +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorAdditionalInfo +1. ErrorDetail +1. ErrorResponse diff --git a/services/authorization/mgmt/2015-07-01/authorization/_meta.json b/services/authorization/mgmt/2015-07-01/authorization/_meta.json index 245f888ed4c0..da72eacf6530 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/_meta.json +++ b/services/authorization/mgmt/2015-07-01/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2015-07-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go b/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go index abe0fe9e4378..d4328f8c201e 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go +++ b/services/authorization/mgmt/2015-07-01/authorization/authorizationapi/interfaces.go @@ -36,9 +36,9 @@ var _ RoleDefinitionsClientAPI = (*authorization.RoleDefinitionsClient)(nil) // ProviderOperationsMetadataClientAPI contains the set of methods on the ProviderOperationsMetadataClient type. type ProviderOperationsMetadataClientAPI interface { - Get(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (result authorization.ProviderOperationsMetadata, err error) - List(ctx context.Context, APIVersion string, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error) - ListComplete(ctx context.Context, APIVersion string, expand string) (result authorization.ProviderOperationsMetadataListResultIterator, err error) + Get(ctx context.Context, resourceProviderNamespace string, expand string) (result authorization.ProviderOperationsMetadata, err error) + List(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error) + ListComplete(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultIterator, err error) } var _ ProviderOperationsMetadataClientAPI = (*authorization.ProviderOperationsMetadataClient)(nil) diff --git a/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go b/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go index cdff22469469..d0e42af959e3 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go +++ b/services/authorization/mgmt/2015-07-01/authorization/classicadministrators.go @@ -10,6 +10,7 @@ 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" ) @@ -46,6 +47,12 @@ func (client ClassicAdministratorsClient) List(ctx context.Context) (result Clas 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("authorization.ClassicAdministratorsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { diff --git a/services/authorization/mgmt/2015-07-01/authorization/models.go b/services/authorization/mgmt/2015-07-01/authorization/models.go index 79d95b5c8d46..668001bf0aff 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/models.go +++ b/services/authorization/mgmt/2015-07-01/authorization/models.go @@ -267,6 +267,47 @@ type ClassicAdministratorProperties struct { Role *string `json:"role,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // Permission role definition permissions. type Permission struct { // Actions - Allowed actions. diff --git a/services/authorization/mgmt/2015-07-01/authorization/permissions.go b/services/authorization/mgmt/2015-07-01/authorization/permissions.go index a3358cbeb722..6acd393f3a27 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/permissions.go +++ b/services/authorization/mgmt/2015-07-01/authorization/permissions.go @@ -10,6 +10,7 @@ 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" ) @@ -35,7 +36,7 @@ func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) Perm // ListForResource gets all permissions the caller has for a resource. // Parameters: -// resourceGroupName - the name of the resource group containing the resource. The name is case insensitive. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -51,6 +52,15 @@ func (client PermissionsClient) ListForResource(ctx context.Context, resourceGro 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("authorization.PermissionsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) if err != nil { @@ -159,7 +169,7 @@ func (client PermissionsClient) ListForResourceComplete(ctx context.Context, res // ListForResourceGroup gets all permissions the caller has for a resource group. // Parameters: -// resourceGroupName - the name of the resource group to get the permissions for. The name is case insensitive. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") @@ -171,6 +181,15 @@ func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resour 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("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) if err != nil { diff --git a/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go b/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go index ac10ce7754d9..01c464a610e8 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go +++ b/services/authorization/mgmt/2015-07-01/authorization/provideroperationsmetadata.go @@ -37,9 +37,8 @@ func NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscription // Get gets provider operations metadata for the specified resource provider. // Parameters: // resourceProviderNamespace - the namespace of the resource provider. -// APIVersion - the API version to use for the operation. // expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (result ProviderOperationsMetadata, err error) { +func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.Get") defer func() { @@ -50,7 +49,7 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, resourceProviderNamespace, APIVersion, expand) + req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) if err != nil { err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") return @@ -73,11 +72,12 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource } // GetPreparer prepares the Get request. -func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -115,9 +115,8 @@ func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) // List gets provider operations metadata for all resource providers. // Parameters: -// APIVersion - the API version to use for this operation. // expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVersion string, expand string) (result ProviderOperationsMetadataListResultPage, err error) { +func (client ProviderOperationsMetadataClient) List(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") defer func() { @@ -129,7 +128,7 @@ func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVers }() } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, APIVersion, expand) + req, err := client.ListPreparer(ctx, expand) if err != nil { err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") return @@ -156,7 +155,8 @@ func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVers } // ListPreparer prepares the List request. -func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, APIVersion string, expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, expand string) (*http.Request, error) { + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -214,7 +214,7 @@ func (client ProviderOperationsMetadataClient) listNextResults(ctx context.Conte } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, APIVersion string, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { +func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") defer func() { @@ -225,6 +225,6 @@ func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, APIVersion, expand) + result.page, err = client.List(ctx, expand) return } diff --git a/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go b/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go index 43897ed795c4..ddb1ee9036ce 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go +++ b/services/authorization/mgmt/2015-07-01/authorization/roleassignments.go @@ -41,7 +41,8 @@ func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. -// roleAssignmentName - the name of the role assignment to create. It can be any valid GUID. +// roleAssignmentName - a GUID for the role assignment to create. The name must be unique and different for +// each role assignment. // parameters - parameters for the role assignment. func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { if tracing.IsEnabled() { @@ -281,7 +282,7 @@ func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -357,7 +358,7 @@ func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.R func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -531,6 +532,12 @@ func (client RoleAssignmentsClient) List(ctx context.Context, filter string) (re 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("authorization.RoleAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -637,7 +644,7 @@ func (client RoleAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets role assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -656,6 +663,15 @@ func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -767,7 +783,7 @@ func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets role assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or // above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope // for the specified principal. @@ -782,6 +798,15 @@ func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go b/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go index 5bc63943465a..1d17715bff18 100644 --- a/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go +++ b/services/authorization/mgmt/2015-07-01/authorization/roledefinitions.go @@ -182,7 +182,7 @@ func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/authorization/mgmt/2020-10-01/authorization/CHANGELOG.md b/services/authorization/mgmt/2020-10-01/authorization/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/authorization/mgmt/2020-10-01/authorization/CHANGELOG.md +++ b/services/authorization/mgmt/2020-10-01/authorization/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/authorization/mgmt/2020-10-01/authorization/_meta.json b/services/authorization/mgmt/2020-10-01/authorization/_meta.json index c98e572dc5e2..7e100b911b9f 100644 --- a/services/authorization/mgmt/2020-10-01/authorization/_meta.json +++ b/services/authorization/mgmt/2020-10-01/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "e7d2d8c48cf6f8f63de7e252c467930449b5fd88", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2020-10-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/digitaltwins/mgmt/2020-10-31/digitaltwins/CHANGELOG.md b/services/digitaltwins/mgmt/2020-10-31/digitaltwins/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/digitaltwins/mgmt/2020-10-31/digitaltwins/CHANGELOG.md +++ b/services/digitaltwins/mgmt/2020-10-31/digitaltwins/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/digitaltwins/mgmt/2020-10-31/digitaltwins/_meta.json b/services/digitaltwins/mgmt/2020-10-31/digitaltwins/_meta.json index 3a116b1de2f4..3ffd7148c660 100644 --- a/services/digitaltwins/mgmt/2020-10-31/digitaltwins/_meta.json +++ b/services/digitaltwins/mgmt/2020-10-31/digitaltwins/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md", "tag": "package-2020-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/digitaltwins/mgmt/2020-12-01/digitaltwins/CHANGELOG.md b/services/digitaltwins/mgmt/2020-12-01/digitaltwins/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/digitaltwins/mgmt/2020-12-01/digitaltwins/CHANGELOG.md +++ b/services/digitaltwins/mgmt/2020-12-01/digitaltwins/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/digitaltwins/mgmt/2020-12-01/digitaltwins/_meta.json b/services/digitaltwins/mgmt/2020-12-01/digitaltwins/_meta.json index 45dba55c3365..c78230284368 100644 --- a/services/digitaltwins/mgmt/2020-12-01/digitaltwins/_meta.json +++ b/services/digitaltwins/mgmt/2020-12-01/digitaltwins/_meta.json @@ -1,5 +1,5 @@ { - "commit": "d9506558e6389e62926ae385f1d625a1376a0f9d", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md", "tag": "package-2020-12", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/dns/mgmt/2016-04-01/dns/CHANGELOG.md b/services/dns/mgmt/2016-04-01/dns/CHANGELOG.md index 52911e4cc5e4..5a2c1d0748c6 100644 --- a/services/dns/mgmt/2016-04-01/dns/CHANGELOG.md +++ b/services/dns/mgmt/2016-04-01/dns/CHANGELOG.md @@ -1,2 +1,18 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. ZoneType.Private +1. ZoneType.Public + +### New Funcs + +1. PossibleZoneTypeValues() []ZoneType + +### Struct Changes + +#### New Struct Fields + +1. ZoneProperties.ZoneType diff --git a/services/dns/mgmt/2016-04-01/dns/_meta.json b/services/dns/mgmt/2016-04-01/dns/_meta.json index a8b1d8a69dd0..5f87405bf8b2 100644 --- a/services/dns/mgmt/2016-04-01/dns/_meta.json +++ b/services/dns/mgmt/2016-04-01/dns/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", "tag": "package-2016-04", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/dns/mgmt/2016-04-01/dns/enums.go b/services/dns/mgmt/2016-04-01/dns/enums.go index 384b4c770f6a..c06daa88935a 100644 --- a/services/dns/mgmt/2016-04-01/dns/enums.go +++ b/services/dns/mgmt/2016-04-01/dns/enums.go @@ -156,3 +156,18 @@ const ( func PossibleRecordTypeValues() []RecordType { return []RecordType{A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT} } + +// ZoneType enumerates the values for zone type. +type ZoneType string + +const ( + // Private ... + Private ZoneType = "Private" + // Public ... + Public ZoneType = "Public" +) + +// PossibleZoneTypeValues returns an array of possible values for the ZoneType const type. +func PossibleZoneTypeValues() []ZoneType { + return []ZoneType{Private, Public} +} diff --git a/services/dns/mgmt/2016-04-01/dns/models.go b/services/dns/mgmt/2016-04-01/dns/models.go index 92e820a4af41..6357b10292d5 100644 --- a/services/dns/mgmt/2016-04-01/dns/models.go +++ b/services/dns/mgmt/2016-04-01/dns/models.go @@ -819,6 +819,8 @@ type ZoneProperties struct { NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` // NameServers - READ-ONLY; The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. NameServers *[]string `json:"nameServers,omitempty"` + // ZoneType - The type of this DNS zone (Public or Private). Possible values include: 'Public', 'Private' + ZoneType ZoneType `json:"zoneType,omitempty"` } // MarshalJSON is the custom marshaler for ZoneProperties. @@ -830,6 +832,9 @@ func (zp ZoneProperties) MarshalJSON() ([]byte, error) { if zp.NumberOfRecordSets != nil { objectMap["numberOfRecordSets"] = zp.NumberOfRecordSets } + if zp.ZoneType != "" { + objectMap["zoneType"] = zp.ZoneType + } return json.Marshal(objectMap) } diff --git a/services/dns/mgmt/2016-04-01/dns/recordsets.go b/services/dns/mgmt/2016-04-01/dns/recordsets.go index c1db455eb59a..15de46b571f8 100644 --- a/services/dns/mgmt/2016-04-01/dns/recordsets.go +++ b/services/dns/mgmt/2016-04-01/dns/recordsets.go @@ -57,8 +57,7 @@ func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroup 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("dns.RecordSetsClient", "CreateOrUpdate", err.Error()) @@ -160,8 +159,7 @@ func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Delete", err.Error()) @@ -253,8 +251,7 @@ func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string 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("dns.RecordSetsClient", "Get", err.Error()) @@ -345,8 +342,7 @@ func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupN 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("dns.RecordSetsClient", "ListByDNSZone", err.Error()) @@ -484,8 +480,7 @@ func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName 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("dns.RecordSetsClient", "ListByType", err.Error()) @@ -624,8 +619,7 @@ func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Update", err.Error()) diff --git a/services/dns/mgmt/2016-04-01/dns/zones.go b/services/dns/mgmt/2016-04-01/dns/zones.go index 027b114655e2..550526bfba04 100644 --- a/services/dns/mgmt/2016-04-01/dns/zones.go +++ b/services/dns/mgmt/2016-04-01/dns/zones.go @@ -54,8 +54,7 @@ func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName 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("dns.ZonesClient", "CreateOrUpdate", err.Error()) @@ -153,8 +152,7 @@ func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, 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("dns.ZonesClient", "Delete", err.Error()) @@ -246,8 +244,7 @@ func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zon 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("dns.ZonesClient", "Get", err.Error()) @@ -456,8 +453,7 @@ func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroup 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("dns.ZonesClient", "ListByResourceGroup", err.Error()) diff --git a/services/dns/mgmt/2017-09-01/dns/CHANGELOG.md b/services/dns/mgmt/2017-09-01/dns/CHANGELOG.md index 52911e4cc5e4..5a2c1d0748c6 100644 --- a/services/dns/mgmt/2017-09-01/dns/CHANGELOG.md +++ b/services/dns/mgmt/2017-09-01/dns/CHANGELOG.md @@ -1,2 +1,18 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. ZoneType.Private +1. ZoneType.Public + +### New Funcs + +1. PossibleZoneTypeValues() []ZoneType + +### Struct Changes + +#### New Struct Fields + +1. ZoneProperties.ZoneType diff --git a/services/dns/mgmt/2017-09-01/dns/_meta.json b/services/dns/mgmt/2017-09-01/dns/_meta.json index fab92d2cd2c5..5e649c6029fb 100644 --- a/services/dns/mgmt/2017-09-01/dns/_meta.json +++ b/services/dns/mgmt/2017-09-01/dns/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", "tag": "package-2017-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/dns/mgmt/2017-09-01/dns/enums.go b/services/dns/mgmt/2017-09-01/dns/enums.go index 66406f6e0e76..90319affc9b9 100644 --- a/services/dns/mgmt/2017-09-01/dns/enums.go +++ b/services/dns/mgmt/2017-09-01/dns/enums.go @@ -36,3 +36,18 @@ const ( func PossibleRecordTypeValues() []RecordType { return []RecordType{A, AAAA, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT} } + +// ZoneType enumerates the values for zone type. +type ZoneType string + +const ( + // Private ... + Private ZoneType = "Private" + // Public ... + Public ZoneType = "Public" +) + +// PossibleZoneTypeValues returns an array of possible values for the ZoneType const type. +func PossibleZoneTypeValues() []ZoneType { + return []ZoneType{Private, Public} +} diff --git a/services/dns/mgmt/2017-09-01/dns/models.go b/services/dns/mgmt/2017-09-01/dns/models.go index a97fcc972195..79f2dd8e8757 100644 --- a/services/dns/mgmt/2017-09-01/dns/models.go +++ b/services/dns/mgmt/2017-09-01/dns/models.go @@ -831,11 +831,16 @@ type ZoneProperties struct { NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` // NameServers - READ-ONLY; The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. NameServers *[]string `json:"nameServers,omitempty"` + // ZoneType - The type of this DNS zone (Public or Private). Possible values include: 'Public', 'Private' + ZoneType ZoneType `json:"zoneType,omitempty"` } // MarshalJSON is the custom marshaler for ZoneProperties. func (zp ZoneProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if zp.ZoneType != "" { + objectMap["zoneType"] = zp.ZoneType + } return json.Marshal(objectMap) } diff --git a/services/dns/mgmt/2017-09-01/dns/recordsets.go b/services/dns/mgmt/2017-09-01/dns/recordsets.go index e1a0aa9a21ea..50cb8872f3b9 100644 --- a/services/dns/mgmt/2017-09-01/dns/recordsets.go +++ b/services/dns/mgmt/2017-09-01/dns/recordsets.go @@ -57,8 +57,7 @@ func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroup 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("dns.RecordSetsClient", "CreateOrUpdate", err.Error()) @@ -163,8 +162,7 @@ func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Delete", err.Error()) @@ -256,8 +254,7 @@ func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string 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("dns.RecordSetsClient", "Get", err.Error()) @@ -348,8 +345,7 @@ func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupN 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("dns.RecordSetsClient", "ListByDNSZone", err.Error()) @@ -487,8 +483,7 @@ func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName 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("dns.RecordSetsClient", "ListByType", err.Error()) @@ -627,8 +622,7 @@ func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Update", err.Error()) diff --git a/services/dns/mgmt/2017-09-01/dns/zones.go b/services/dns/mgmt/2017-09-01/dns/zones.go index ac151de09714..45ee72fa1e21 100644 --- a/services/dns/mgmt/2017-09-01/dns/zones.go +++ b/services/dns/mgmt/2017-09-01/dns/zones.go @@ -54,8 +54,7 @@ func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName 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("dns.ZonesClient", "CreateOrUpdate", err.Error()) @@ -153,8 +152,7 @@ func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, 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("dns.ZonesClient", "Delete", err.Error()) @@ -245,8 +243,7 @@ func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zon 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("dns.ZonesClient", "Get", err.Error()) @@ -455,8 +452,7 @@ func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroup 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("dns.ZonesClient", "ListByResourceGroup", err.Error()) diff --git a/services/dns/mgmt/2017-10-01/dns/CHANGELOG.md b/services/dns/mgmt/2017-10-01/dns/CHANGELOG.md index 52911e4cc5e4..5a2c1d0748c6 100644 --- a/services/dns/mgmt/2017-10-01/dns/CHANGELOG.md +++ b/services/dns/mgmt/2017-10-01/dns/CHANGELOG.md @@ -1,2 +1,18 @@ -# Change History +# Unreleased +## Additive Changes + +### New Constants + +1. ZoneType.Private +1. ZoneType.Public + +### New Funcs + +1. PossibleZoneTypeValues() []ZoneType + +### Struct Changes + +#### New Struct Fields + +1. ZoneProperties.ZoneType diff --git a/services/dns/mgmt/2017-10-01/dns/_meta.json b/services/dns/mgmt/2017-10-01/dns/_meta.json index 19173451e13e..1cb56fe26606 100644 --- a/services/dns/mgmt/2017-10-01/dns/_meta.json +++ b/services/dns/mgmt/2017-10-01/dns/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", "tag": "package-2017-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/dns/mgmt/2017-10-01/dns/enums.go b/services/dns/mgmt/2017-10-01/dns/enums.go index 66406f6e0e76..90319affc9b9 100644 --- a/services/dns/mgmt/2017-10-01/dns/enums.go +++ b/services/dns/mgmt/2017-10-01/dns/enums.go @@ -36,3 +36,18 @@ const ( func PossibleRecordTypeValues() []RecordType { return []RecordType{A, AAAA, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT} } + +// ZoneType enumerates the values for zone type. +type ZoneType string + +const ( + // Private ... + Private ZoneType = "Private" + // Public ... + Public ZoneType = "Public" +) + +// PossibleZoneTypeValues returns an array of possible values for the ZoneType const type. +func PossibleZoneTypeValues() []ZoneType { + return []ZoneType{Private, Public} +} diff --git a/services/dns/mgmt/2017-10-01/dns/models.go b/services/dns/mgmt/2017-10-01/dns/models.go index e376def331ba..9e4fcfba7529 100644 --- a/services/dns/mgmt/2017-10-01/dns/models.go +++ b/services/dns/mgmt/2017-10-01/dns/models.go @@ -831,11 +831,16 @@ type ZoneProperties struct { NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` // NameServers - READ-ONLY; The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. NameServers *[]string `json:"nameServers,omitempty"` + // ZoneType - The type of this DNS zone (Public or Private). Possible values include: 'Public', 'Private' + ZoneType ZoneType `json:"zoneType,omitempty"` } // MarshalJSON is the custom marshaler for ZoneProperties. func (zp ZoneProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + if zp.ZoneType != "" { + objectMap["zoneType"] = zp.ZoneType + } return json.Marshal(objectMap) } diff --git a/services/dns/mgmt/2017-10-01/dns/recordsets.go b/services/dns/mgmt/2017-10-01/dns/recordsets.go index 3786d3d27501..81ce48424166 100644 --- a/services/dns/mgmt/2017-10-01/dns/recordsets.go +++ b/services/dns/mgmt/2017-10-01/dns/recordsets.go @@ -57,8 +57,7 @@ func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroup 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("dns.RecordSetsClient", "CreateOrUpdate", err.Error()) @@ -163,8 +162,7 @@ func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Delete", err.Error()) @@ -256,8 +254,7 @@ func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string 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("dns.RecordSetsClient", "Get", err.Error()) @@ -348,8 +345,7 @@ func (client RecordSetsClient) ListAllByDNSZone(ctx context.Context, resourceGro 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("dns.RecordSetsClient", "ListAllByDNSZone", err.Error()) @@ -486,8 +482,7 @@ func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupN 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("dns.RecordSetsClient", "ListByDNSZone", err.Error()) @@ -625,8 +620,7 @@ func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName 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("dns.RecordSetsClient", "ListByType", err.Error()) @@ -765,8 +759,7 @@ func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Update", err.Error()) diff --git a/services/dns/mgmt/2017-10-01/dns/zones.go b/services/dns/mgmt/2017-10-01/dns/zones.go index 0f512735f8c6..1ada36de8501 100644 --- a/services/dns/mgmt/2017-10-01/dns/zones.go +++ b/services/dns/mgmt/2017-10-01/dns/zones.go @@ -54,8 +54,7 @@ func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName 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("dns.ZonesClient", "CreateOrUpdate", err.Error()) @@ -153,8 +152,7 @@ func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, 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("dns.ZonesClient", "Delete", err.Error()) @@ -245,8 +243,7 @@ func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zon 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("dns.ZonesClient", "Get", err.Error()) @@ -455,8 +452,7 @@ func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroup 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("dns.ZonesClient", "ListByResourceGroup", err.Error()) @@ -588,8 +584,7 @@ func (client ZonesClient) Update(ctx context.Context, resourceGroupName string, 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("dns.ZonesClient", "Update", err.Error()) diff --git a/services/dns/mgmt/2018-05-01/dns/CHANGELOG.md b/services/dns/mgmt/2018-05-01/dns/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/dns/mgmt/2018-05-01/dns/CHANGELOG.md +++ b/services/dns/mgmt/2018-05-01/dns/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/dns/mgmt/2018-05-01/dns/_meta.json b/services/dns/mgmt/2018-05-01/dns/_meta.json index f3f56908137e..d830d5bc20f9 100644 --- a/services/dns/mgmt/2018-05-01/dns/_meta.json +++ b/services/dns/mgmt/2018-05-01/dns/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", "tag": "package-2018-05", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json index 9193f38b394c..4ed2e5177bec 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "92ab22b49bd085116af0c61fada2c6c360702e9e", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2021-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go index cb77012e286d..f7503b28aefb 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/client.go @@ -1,6 +1,6 @@ // Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version 2021-03-01. // -// Use these APIs to create Source Control Configuration resources through ARM, for Kubernetes Clusters. +// KubernetesConfiguration Client package kubernetesconfiguration // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go index 3cfe20c6f942..45d561c39010 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/operations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// OperationsClient is the use these APIs to create Source Control Configuration resources through ARM, for Kubernetes -// Clusters. +// OperationsClient is the kubernetesConfiguration Client type OperationsClient struct { BaseClient } diff --git a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go index 0ea1a556f7b9..54ac3d16fc38 100644 --- a/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go +++ b/services/kubernetesconfiguration/mgmt/2021-03-01/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// SourceControlConfigurationsClient is the use these APIs to create Source Control Configuration resources through -// ARM, for Kubernetes Clusters. +// SourceControlConfigurationsClient is the kubernetesConfiguration Client type SourceControlConfigurationsClient struct { BaseClient } diff --git a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md +++ b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json index 4ce5f7bc5cf9..afe24df4cb73 100644 --- a/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json +++ b/services/kubernetesconfiguration/mgmt/2021-09-01/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c5135f8325eaf79be7b137cae363bdcba028c17", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2021-09", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md +++ b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json index 815367175194..1a71b35d116b 100644 --- a/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json +++ b/services/kubernetesconfiguration/mgmt/2022-03-01/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "61218420e95ad3435a029144877b110b56418958", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2022-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/CHANGELOG.md b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/_meta.json b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/_meta.json deleted file mode 100644 index f76c0ff30699..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "b548283ea6f4b3d797e85432fcc6e3ff2a2ac224", - "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", - "tag": "package-2020-02-02", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-02-02 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/analyticsitems.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/analyticsitems.go deleted file mode 100644 index 2e08deb5b096..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/analyticsitems.go +++ /dev/null @@ -1,429 +0,0 @@ -package insights - -// 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" -) - -// AnalyticsItemsClient is the composite Swagger for Application Insights Management Client -type AnalyticsItemsClient struct { - BaseClient -} - -// NewAnalyticsItemsClient creates an instance of the AnalyticsItemsClient client. -func NewAnalyticsItemsClient(subscriptionID string) AnalyticsItemsClient { - return NewAnalyticsItemsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAnalyticsItemsClientWithBaseURI creates an instance of the AnalyticsItemsClient 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 NewAnalyticsItemsClientWithBaseURI(baseURI string, subscriptionID string) AnalyticsItemsClient { - return AnalyticsItemsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete deletes a specific Analytics Items defined within an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all -// users with access to the Application Insights component. -// ID - the Id of a specific item defined in the Application Insights component -// name - the name of a specific item defined in the Application Insights component -func (client AnalyticsItemsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.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("insights.AnalyticsItemsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AnalyticsItemsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(ID) > 0 { - queryParameters["id"] = autorest.Encode("query", ID) - } - if len(name) > 0 { - queryParameters["name"] = autorest.Encode("query", name) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", 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 AnalyticsItemsClient) 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 AnalyticsItemsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets a specific Analytics Items defined within an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all -// users with access to the Application Insights component. -// ID - the Id of a specific item defined in the Application Insights component -// name - the name of a specific item defined in the Application Insights component -func (client AnalyticsItemsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (result ApplicationInsightsComponentAnalyticsItem, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.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("insights.AnalyticsItemsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, scopePath, ID, name) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AnalyticsItemsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, ID string, name string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(ID) > 0 { - queryParameters["id"] = autorest.Encode("query", ID) - } - if len(name) > 0 { - queryParameters["name"] = autorest.Encode("query", name) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}/item", 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 AnalyticsItemsClient) 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 AnalyticsItemsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of Analytics Items defined within an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all -// users with access to the Application Insights component. -// scope - enum indicating if this item definition is owned by a specific user or is shared between all users -// with access to the Application Insights component. -// typeParameter - enum indicating the type of the Analytics item. -// includeContent - flag indicating whether or not to return the content of each applicable item. If false, -// only return the item information. -func (client AnalyticsItemsClient) List(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (result ListApplicationInsightsComponentAnalyticsItem, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.List") - 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("insights.AnalyticsItemsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, scopePath, scope, typeParameter, includeContent) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AnalyticsItemsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, scope ItemScope, typeParameter ItemTypeParameter, includeContent *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(scope)) > 0 { - queryParameters["scope"] = autorest.Encode("query", scope) - } else { - queryParameters["scope"] = autorest.Encode("query", "shared") - } - if len(string(typeParameter)) > 0 { - queryParameters["type"] = autorest.Encode("query", typeParameter) - } else { - queryParameters["type"] = autorest.Encode("query", "none") - } - if includeContent != nil { - queryParameters["includeContent"] = autorest.Encode("query", *includeContent) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/{scopePath}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AnalyticsItemsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AnalyticsItemsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentAnalyticsItem, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Put adds or Updates a specific Analytics Item within an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// scopePath - enum indicating if this item definition is owned by a specific user or is shared between all -// users with access to the Application Insights component. -// itemProperties - properties that need to be specified to create a new item and add it to an Application -// Insights component. -// overrideItem - flag indicating whether or not to force save an item. This allows overriding an item if it -// already exists. -func (client AnalyticsItemsClient) Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (result ApplicationInsightsComponentAnalyticsItem, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnalyticsItemsClient.Put") - 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("insights.AnalyticsItemsClient", "Put", err.Error()) - } - - req, err := client.PutPreparer(ctx, resourceGroupName, resourceName, scopePath, itemProperties, overrideItem) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", nil, "Failure preparing request") - return - } - - resp, err := client.PutSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", resp, "Failure sending request") - return - } - - result, err = client.PutResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnalyticsItemsClient", "Put", resp, "Failure responding to request") - return - } - - return -} - -// PutPreparer prepares the Put request. -func (client AnalyticsItemsClient) PutPreparer(ctx context.Context, resourceGroupName string, resourceName string, scopePath ItemScopePath, itemProperties ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "scopePath": autorest.Encode("path", scopePath), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if overrideItem != nil { - queryParameters["overrideItem"] = autorest.Encode("query", *overrideItem) - } - - itemProperties.Version = nil - itemProperties.TimeCreated = nil - itemProperties.TimeModified = 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.insights/components/{resourceName}/{scopePath}/item", pathParameters), - autorest.WithJSON(itemProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PutSender sends the Put request. The method will close the -// http.Response Body if it receives an error. -func (client AnalyticsItemsClient) PutSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PutResponder handles the response to the Put request. The method always -// closes the http.Response Body. -func (client AnalyticsItemsClient) PutResponder(resp *http.Response) (result ApplicationInsightsComponentAnalyticsItem, 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/appinsights/mgmt/2020-02-02-preview/insights/annotations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/annotations.go deleted file mode 100644 index aa31fd7d0e74..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/annotations.go +++ /dev/null @@ -1,383 +0,0 @@ -package insights - -// 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" -) - -// AnnotationsClient is the composite Swagger for Application Insights Management Client -type AnnotationsClient struct { - BaseClient -} - -// NewAnnotationsClient creates an instance of the AnnotationsClient client. -func NewAnnotationsClient(subscriptionID string) AnnotationsClient { - return NewAnnotationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAnnotationsClientWithBaseURI creates an instance of the AnnotationsClient 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 NewAnnotationsClientWithBaseURI(baseURI string, subscriptionID string) AnnotationsClient { - return AnnotationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create an Annotation of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// annotationProperties - properties that need to be specified to create an annotation of a Application -// Insights component. -func (client AnnotationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties Annotation) (result ListAnnotation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.Create") - 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("insights.AnnotationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, annotationProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client AnnotationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties Annotation) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", pathParameters), - autorest.WithJSON(annotationProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client AnnotationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client AnnotationsClient) CreateResponder(resp *http.Response) (result ListAnnotation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an Annotation of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// annotationID - the unique annotation ID. This is unique within a Application Insights component. -func (client AnnotationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.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("insights.AnnotationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, annotationID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AnnotationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "annotationId": autorest.Encode("path", annotationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", 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 AnnotationsClient) 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 AnnotationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the annotation for given id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// annotationID - the unique annotation ID. This is unique within a Application Insights component. -func (client AnnotationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result ListAnnotation, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.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("insights.AnnotationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, annotationID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AnnotationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "annotationId": autorest.Encode("path", annotationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations/{annotationId}", 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 AnnotationsClient) 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 AnnotationsClient) GetResponder(resp *http.Response) (result ListAnnotation, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the list of annotations for a component for given time range -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// start - the start time to query from for annotations, cannot be older than 90 days from current date. -// end - the end time to query for annotations. -func (client AnnotationsClient) List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result AnnotationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AnnotationsClient.List") - 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("insights.AnnotationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, start, end) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.AnnotationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AnnotationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "end": autorest.Encode("query", end), - "start": autorest.Encode("query", start), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/Annotations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AnnotationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AnnotationsClient) ListResponder(resp *http.Response) (result AnnotationsListResult, 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/appinsights/mgmt/2020-02-02-preview/insights/apikeys.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/apikeys.go deleted file mode 100644 index ca33d3c4c68d..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/apikeys.go +++ /dev/null @@ -1,380 +0,0 @@ -package insights - -// 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" -) - -// APIKeysClient is the composite Swagger for Application Insights Management Client -type APIKeysClient struct { - BaseClient -} - -// NewAPIKeysClient creates an instance of the APIKeysClient client. -func NewAPIKeysClient(subscriptionID string) APIKeysClient { - return NewAPIKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAPIKeysClientWithBaseURI creates an instance of the APIKeysClient 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 NewAPIKeysClientWithBaseURI(baseURI string, subscriptionID string) APIKeysClient { - return APIKeysClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create an API Key of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// APIKeyProperties - properties that need to be specified to create an API key of a Application Insights -// component. -func (client APIKeysClient) Create(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties APIKeyRequest) (result ApplicationInsightsComponentAPIKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Create") - 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("insights.APIKeysClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, APIKeyProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client APIKeysClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties APIKeyRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", pathParameters), - autorest.WithJSON(APIKeyProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client APIKeysClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client APIKeysClient) CreateResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete an API Key of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// keyID - the API Key ID. This is unique within a Application Insights component. -func (client APIKeysClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result ApplicationInsightsComponentAPIKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.Delete") - 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("insights.APIKeysClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, keyID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client APIKeysClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyId": autorest.Encode("path", keyID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", 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 APIKeysClient) 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 APIKeysClient) DeleteResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the API Key for this key id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// keyID - the API Key ID. This is unique within a Application Insights component. -func (client APIKeysClient) Get(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result ApplicationInsightsComponentAPIKey, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.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("insights.APIKeysClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, keyID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client APIKeysClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "keyId": autorest.Encode("path", keyID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/APIKeys/{keyId}", 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 APIKeysClient) 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 APIKeysClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKey, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of API keys of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client APIKeysClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentAPIKeyListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/APIKeysClient.List") - 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("insights.APIKeysClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.APIKeysClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client APIKeysClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ApiKeys", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client APIKeysClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client APIKeysClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentAPIKeyListResult, 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/appinsights/mgmt/2020-02-02-preview/insights/componentavailablefeatures.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentavailablefeatures.go deleted file mode 100644 index 997a483b327f..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentavailablefeatures.go +++ /dev/null @@ -1,118 +0,0 @@ -package insights - -// 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" -) - -// ComponentAvailableFeaturesClient is the composite Swagger for Application Insights Management Client -type ComponentAvailableFeaturesClient struct { - BaseClient -} - -// NewComponentAvailableFeaturesClient creates an instance of the ComponentAvailableFeaturesClient client. -func NewComponentAvailableFeaturesClient(subscriptionID string) ComponentAvailableFeaturesClient { - return NewComponentAvailableFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewComponentAvailableFeaturesClientWithBaseURI creates an instance of the ComponentAvailableFeaturesClient 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 NewComponentAvailableFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentAvailableFeaturesClient { - return ComponentAvailableFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns all available features of the application insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentAvailableFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentAvailableFeatures, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentAvailableFeaturesClient.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("insights.ComponentAvailableFeaturesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentAvailableFeaturesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ComponentAvailableFeaturesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/getavailablebillingfeatures", 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 ComponentAvailableFeaturesClient) 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 ComponentAvailableFeaturesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentAvailableFeatures, 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/appinsights/mgmt/2020-02-02-preview/insights/componentcurrentbillingfeatures.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentcurrentbillingfeatures.go deleted file mode 100644 index 3416a616be9c..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentcurrentbillingfeatures.go +++ /dev/null @@ -1,207 +0,0 @@ -package insights - -// 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" -) - -// ComponentCurrentBillingFeaturesClient is the composite Swagger for Application Insights Management Client -type ComponentCurrentBillingFeaturesClient struct { - BaseClient -} - -// NewComponentCurrentBillingFeaturesClient creates an instance of the ComponentCurrentBillingFeaturesClient client. -func NewComponentCurrentBillingFeaturesClient(subscriptionID string) ComponentCurrentBillingFeaturesClient { - return NewComponentCurrentBillingFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewComponentCurrentBillingFeaturesClientWithBaseURI creates an instance of the ComponentCurrentBillingFeaturesClient -// 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 NewComponentCurrentBillingFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentCurrentBillingFeaturesClient { - return ComponentCurrentBillingFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns current billing features for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentCurrentBillingFeaturesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentBillingFeatures, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentCurrentBillingFeaturesClient.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("insights.ComponentCurrentBillingFeaturesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ComponentCurrentBillingFeaturesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", 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 ComponentCurrentBillingFeaturesClient) 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 ComponentCurrentBillingFeaturesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentBillingFeatures, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update current billing features for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// billingFeaturesProperties - properties that need to be specified to update billing features for an -// Application Insights component. -func (client ComponentCurrentBillingFeaturesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties ApplicationInsightsComponentBillingFeatures) (result ApplicationInsightsComponentBillingFeatures, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentCurrentBillingFeaturesClient.Update") - 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("insights.ComponentCurrentBillingFeaturesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, billingFeaturesProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentCurrentBillingFeaturesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ComponentCurrentBillingFeaturesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties ApplicationInsightsComponentBillingFeatures) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/currentbillingfeatures", pathParameters), - autorest.WithJSON(billingFeaturesProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentCurrentBillingFeaturesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ComponentCurrentBillingFeaturesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentBillingFeatures, 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/appinsights/mgmt/2020-02-02-preview/insights/componentfeaturecapabilities.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentfeaturecapabilities.go deleted file mode 100644 index 0620681495e8..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentfeaturecapabilities.go +++ /dev/null @@ -1,118 +0,0 @@ -package insights - -// 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" -) - -// ComponentFeatureCapabilitiesClient is the composite Swagger for Application Insights Management Client -type ComponentFeatureCapabilitiesClient struct { - BaseClient -} - -// NewComponentFeatureCapabilitiesClient creates an instance of the ComponentFeatureCapabilitiesClient client. -func NewComponentFeatureCapabilitiesClient(subscriptionID string) ComponentFeatureCapabilitiesClient { - return NewComponentFeatureCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewComponentFeatureCapabilitiesClientWithBaseURI creates an instance of the ComponentFeatureCapabilitiesClient -// 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 NewComponentFeatureCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) ComponentFeatureCapabilitiesClient { - return ComponentFeatureCapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns feature capabilities of the application insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentFeatureCapabilitiesClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentFeatureCapabilities, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentFeatureCapabilitiesClient.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("insights.ComponentFeatureCapabilitiesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentFeatureCapabilitiesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ComponentFeatureCapabilitiesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/featurecapabilities", 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 ComponentFeatureCapabilitiesClient) 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 ComponentFeatureCapabilitiesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFeatureCapabilities, 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/appinsights/mgmt/2020-02-02-preview/insights/componentlinkedstorageaccounts.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentlinkedstorageaccounts.go deleted file mode 100644 index 52a5a107c3fd..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentlinkedstorageaccounts.go +++ /dev/null @@ -1,384 +0,0 @@ -package insights - -// 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" -) - -// ComponentLinkedStorageAccountsClient is the composite Swagger for Application Insights Management Client -type ComponentLinkedStorageAccountsClient struct { - BaseClient -} - -// NewComponentLinkedStorageAccountsClient creates an instance of the ComponentLinkedStorageAccountsClient client. -func NewComponentLinkedStorageAccountsClient(subscriptionID string) ComponentLinkedStorageAccountsClient { - return NewComponentLinkedStorageAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewComponentLinkedStorageAccountsClientWithBaseURI creates an instance of the ComponentLinkedStorageAccountsClient -// 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 NewComponentLinkedStorageAccountsClientWithBaseURI(baseURI string, subscriptionID string) ComponentLinkedStorageAccountsClient { - return ComponentLinkedStorageAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateAndUpdate replace current linked storage account for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// linkedStorageAccountsProperties - properties that need to be specified to update linked storage accounts for -// an Application Insights component. -func (client ComponentLinkedStorageAccountsClient) CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccounts) (result ComponentLinkedStorageAccounts, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.CreateAndUpdate") - 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("insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", err.Error()) - } - - req, err := client.CreateAndUpdatePreparer(ctx, resourceGroupName, resourceName, linkedStorageAccountsProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateAndUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateAndUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "CreateAndUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateAndUpdatePreparer prepares the CreateAndUpdate request. -func (client ComponentLinkedStorageAccountsClient) CreateAndUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccounts) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "storageType": autorest.Encode("path", "ServiceProfiler"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), - autorest.WithJSON(linkedStorageAccountsProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateAndUpdateSender sends the CreateAndUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentLinkedStorageAccountsClient) CreateAndUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateAndUpdateResponder handles the response to the CreateAndUpdate request. The method always -// closes the http.Response Body. -func (client ComponentLinkedStorageAccountsClient) CreateAndUpdateResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete linked storage accounts for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentLinkedStorageAccountsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.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("insights.ComponentLinkedStorageAccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ComponentLinkedStorageAccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "storageType": autorest.Encode("path", "ServiceProfiler"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01-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.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", 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 ComponentLinkedStorageAccountsClient) 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 ComponentLinkedStorageAccountsClient) 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 returns the current linked storage settings for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentLinkedStorageAccountsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ComponentLinkedStorageAccounts, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.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("insights.ComponentLinkedStorageAccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ComponentLinkedStorageAccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "storageType": autorest.Encode("path", "ServiceProfiler"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01-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.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", 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 ComponentLinkedStorageAccountsClient) 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 ComponentLinkedStorageAccountsClient) GetResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update linked storage accounts for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// linkedStorageAccountsProperties - properties that need to be specified to update a linked storage accounts -// for an Application Insights component. -func (client ComponentLinkedStorageAccountsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch) (result ComponentLinkedStorageAccounts, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentLinkedStorageAccountsClient.Update") - 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("insights.ComponentLinkedStorageAccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, linkedStorageAccountsProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentLinkedStorageAccountsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ComponentLinkedStorageAccountsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties ComponentLinkedStorageAccountsPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "storageType": autorest.Encode("path", "ServiceProfiler"), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-03-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/components/{resourceName}/linkedStorageAccounts/{storageType}", pathParameters), - autorest.WithJSON(linkedStorageAccountsProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentLinkedStorageAccountsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ComponentLinkedStorageAccountsClient) UpdateResponder(resp *http.Response) (result ComponentLinkedStorageAccounts, 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/appinsights/mgmt/2020-02-02-preview/insights/componentquotastatus.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentquotastatus.go deleted file mode 100644 index 98d79dda19cd..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/componentquotastatus.go +++ /dev/null @@ -1,118 +0,0 @@ -package insights - -// 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" -) - -// ComponentQuotaStatusClient is the composite Swagger for Application Insights Management Client -type ComponentQuotaStatusClient struct { - BaseClient -} - -// NewComponentQuotaStatusClient creates an instance of the ComponentQuotaStatusClient client. -func NewComponentQuotaStatusClient(subscriptionID string) ComponentQuotaStatusClient { - return NewComponentQuotaStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewComponentQuotaStatusClientWithBaseURI creates an instance of the ComponentQuotaStatusClient 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 NewComponentQuotaStatusClientWithBaseURI(baseURI string, subscriptionID string) ComponentQuotaStatusClient { - return ComponentQuotaStatusClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get returns daily data volume cap (quota) status for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentQuotaStatusClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponentQuotaStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentQuotaStatusClient.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("insights.ComponentQuotaStatusClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentQuotaStatusClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ComponentQuotaStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/quotastatus", 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 ComponentQuotaStatusClient) 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 ComponentQuotaStatusClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentQuotaStatus, 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/appinsights/mgmt/2020-02-02-preview/insights/components.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/components.go deleted file mode 100644 index edd860490ce2..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/components.go +++ /dev/null @@ -1,807 +0,0 @@ -package insights - -// 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" -) - -// ComponentsClient is the composite Swagger for Application Insights Management Client -type ComponentsClient struct { - BaseClient -} - -// NewComponentsClient creates an instance of the ComponentsClient client. -func NewComponentsClient(subscriptionID string) ComponentsClient { - return NewComponentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewComponentsClientWithBaseURI creates an instance of the ComponentsClient 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 NewComponentsClientWithBaseURI(baseURI string, subscriptionID string) ComponentsClient { - return ComponentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates (or updates) an Application Insights component. Note: You cannot specify a different value -// for InstrumentationKey nor AppId in the Put operation. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// insightProperties - properties that need to be specified to create an Application Insights component. -func (client ComponentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (result ApplicationInsightsComponent, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.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: 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}}}, - {TargetValue: insightProperties, - Constraints: []validation.Constraint{{Target: "insightProperties.Kind", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ComponentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, insightProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ComponentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, insightProperties ApplicationInsightsComponent) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), - autorest.WithJSON(insightProperties), - 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 ComponentsClient) 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 ComponentsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.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("insights.ComponentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ComponentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", 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 ComponentsClient) 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 ComponentsClient) 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 returns an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ComponentsClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsComponent, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.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("insights.ComponentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ComponentsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", 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 ComponentsClient) 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 ComponentsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponent, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetPurgeStatus get status for an ongoing purge operation. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// purgeID - in a purge status request, this is the Id of the operation the status of which is returned. -func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result ComponentPurgeStatusResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.GetPurgeStatus") - 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("insights.ComponentsClient", "GetPurgeStatus", err.Error()) - } - - req, err := client.GetPurgeStatusPreparer(ctx, resourceGroupName, resourceName, purgeID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetPurgeStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure sending request") - return - } - - result, err = client.GetPurgeStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetPurgeStatusPreparer prepares the GetPurgeStatus request. -func (client ComponentsClient) GetPurgeStatusPreparer(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "purgeId": autorest.Encode("path", purgeID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/operations/{purgeId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetPurgeStatusSender sends the GetPurgeStatus request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) GetPurgeStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetPurgeStatusResponder handles the response to the GetPurgeStatus request. The method always -// closes the http.Response Body. -func (client ComponentsClient) GetPurgeStatusResponder(resp *http.Response) (result ComponentPurgeStatusResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of all Application Insights components within a subscription. -func (client ComponentsClient) List(ctx context.Context) (result ApplicationInsightsComponentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.List") - defer func() { - sc := -1 - if result.aiclr.Response.Response != nil { - sc = result.aiclr.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("insights.ComponentsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.aiclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", resp, "Failure sending request") - return - } - - result.aiclr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "List", resp, "Failure responding to request") - return - } - if result.aiclr.hasNextLink() && result.aiclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ComponentsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/components", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ComponentsClient) ListResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client ComponentsClient) listNextResults(ctx context.Context, lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { - req, err := lastResults.applicationInsightsComponentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ComponentsClient) ListComplete(ctx context.Context) (result ApplicationInsightsComponentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByResourceGroup gets a list of Application Insights components within a resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client ComponentsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationInsightsComponentListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.aiclr.Response.Response != nil { - sc = result.aiclr.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("insights.ComponentsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.aiclr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.aiclr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.aiclr.hasNextLink() && result.aiclr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ComponentsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client ComponentsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationInsightsComponentListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ComponentsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationInsightsComponentListResult) (result ApplicationInsightsComponentListResult, err error) { - req, err := lastResults.applicationInsightsComponentListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.ComponentsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ComponentsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationInsightsComponentListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// Purge purges data in an Application Insights component by a set of user-defined filters. -// -// In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the -// execution of purge requests by sending a single command whose predicate includes all user identities that require -// purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge -// request to verify that the results are expected. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// body - describes the body of a request to purge data in a single table of an Application Insights component -func (client ComponentsClient) Purge(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (result ComponentPurgeResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.Purge") - 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}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Table", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.Filters", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("insights.ComponentsClient", "Purge", err.Error()) - } - - req, err := client.PurgePreparer(ctx, resourceGroupName, resourceName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", nil, "Failure preparing request") - return - } - - resp, err := client.PurgeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure sending request") - return - } - - result, err = client.PurgeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "Purge", resp, "Failure responding to request") - return - } - - return -} - -// PurgePreparer prepares the Purge request. -func (client ComponentsClient) PurgePreparer(ctx context.Context, resourceGroupName string, resourceName string, body ComponentPurgeBody) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/purge", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PurgeSender sends the Purge request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) PurgeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// PurgeResponder handles the response to the Purge request. The method always -// closes the http.Response Body. -func (client ComponentsClient) PurgeResponder(resp *http.Response) (result ComponentPurgeResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateTags updates an existing component's tags. To update other fields use the CreateOrUpdate method. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// componentTags - updated tag information to set into the component instance. -func (client ComponentsClient) UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, componentTags TagsResource) (result ApplicationInsightsComponent, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ComponentsClient.UpdateTags") - 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("insights.ComponentsClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, resourceName, componentTags) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "UpdateTags", resp, "Failure responding to request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client ComponentsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, resourceName string, componentTags TagsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-02-02" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}", pathParameters), - autorest.WithJSON(componentTags), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client ComponentsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client ComponentsClient) UpdateTagsResponder(resp *http.Response) (result ApplicationInsightsComponent, 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/appinsights/mgmt/2020-02-02-preview/insights/enums.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/enums.go deleted file mode 100644 index f1909b5bbfbc..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/enums.go +++ /dev/null @@ -1,256 +0,0 @@ -package insights - -// 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. - -// ApplicationType enumerates the values for application type. -type ApplicationType string - -const ( - // ApplicationTypeOther ... - ApplicationTypeOther ApplicationType = "other" - // ApplicationTypeWeb ... - ApplicationTypeWeb ApplicationType = "web" -) - -// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. -func PossibleApplicationTypeValues() []ApplicationType { - return []ApplicationType{ApplicationTypeOther, ApplicationTypeWeb} -} - -// CategoryType enumerates the values for category type. -type CategoryType string - -const ( - // CategoryTypePerformance ... - CategoryTypePerformance CategoryType = "performance" - // CategoryTypeRetention ... - CategoryTypeRetention CategoryType = "retention" - // CategoryTypeTSG ... - CategoryTypeTSG CategoryType = "TSG" - // CategoryTypeWorkbook ... - CategoryTypeWorkbook CategoryType = "workbook" -) - -// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{CategoryTypePerformance, CategoryTypeRetention, CategoryTypeTSG, CategoryTypeWorkbook} -} - -// FavoriteSourceType enumerates the values for favorite source type. -type FavoriteSourceType string - -const ( - // FavoriteSourceTypeEvents ... - FavoriteSourceTypeEvents FavoriteSourceType = "events" - // FavoriteSourceTypeFunnel ... - FavoriteSourceTypeFunnel FavoriteSourceType = "funnel" - // FavoriteSourceTypeImpact ... - FavoriteSourceTypeImpact FavoriteSourceType = "impact" - // FavoriteSourceTypeNotebook ... - FavoriteSourceTypeNotebook FavoriteSourceType = "notebook" - // FavoriteSourceTypeRetention ... - FavoriteSourceTypeRetention FavoriteSourceType = "retention" - // FavoriteSourceTypeSegmentation ... - FavoriteSourceTypeSegmentation FavoriteSourceType = "segmentation" - // FavoriteSourceTypeSessions ... - FavoriteSourceTypeSessions FavoriteSourceType = "sessions" - // FavoriteSourceTypeUserflows ... - FavoriteSourceTypeUserflows FavoriteSourceType = "userflows" -) - -// PossibleFavoriteSourceTypeValues returns an array of possible values for the FavoriteSourceType const type. -func PossibleFavoriteSourceTypeValues() []FavoriteSourceType { - return []FavoriteSourceType{FavoriteSourceTypeEvents, FavoriteSourceTypeFunnel, FavoriteSourceTypeImpact, FavoriteSourceTypeNotebook, FavoriteSourceTypeRetention, FavoriteSourceTypeSegmentation, FavoriteSourceTypeSessions, FavoriteSourceTypeUserflows} -} - -// FavoriteType enumerates the values for favorite type. -type FavoriteType string - -const ( - // FavoriteTypeShared ... - FavoriteTypeShared FavoriteType = "shared" - // FavoriteTypeUser ... - FavoriteTypeUser FavoriteType = "user" -) - -// PossibleFavoriteTypeValues returns an array of possible values for the FavoriteType const type. -func PossibleFavoriteTypeValues() []FavoriteType { - return []FavoriteType{FavoriteTypeShared, FavoriteTypeUser} -} - -// FlowType enumerates the values for flow type. -type FlowType string - -const ( - // FlowTypeBluefield ... - FlowTypeBluefield FlowType = "Bluefield" -) - -// PossibleFlowTypeValues returns an array of possible values for the FlowType const type. -func PossibleFlowTypeValues() []FlowType { - return []FlowType{FlowTypeBluefield} -} - -// IngestionMode enumerates the values for ingestion mode. -type IngestionMode string - -const ( - // IngestionModeApplicationInsights ... - IngestionModeApplicationInsights IngestionMode = "ApplicationInsights" - // IngestionModeApplicationInsightsWithDiagnosticSettings ... - IngestionModeApplicationInsightsWithDiagnosticSettings IngestionMode = "ApplicationInsightsWithDiagnosticSettings" - // IngestionModeLogAnalytics ... - IngestionModeLogAnalytics IngestionMode = "LogAnalytics" -) - -// PossibleIngestionModeValues returns an array of possible values for the IngestionMode const type. -func PossibleIngestionModeValues() []IngestionMode { - return []IngestionMode{IngestionModeApplicationInsights, IngestionModeApplicationInsightsWithDiagnosticSettings, IngestionModeLogAnalytics} -} - -// ItemScope enumerates the values for item scope. -type ItemScope string - -const ( - // ItemScopeShared ... - ItemScopeShared ItemScope = "shared" - // ItemScopeUser ... - ItemScopeUser ItemScope = "user" -) - -// PossibleItemScopeValues returns an array of possible values for the ItemScope const type. -func PossibleItemScopeValues() []ItemScope { - return []ItemScope{ItemScopeShared, ItemScopeUser} -} - -// ItemScopePath enumerates the values for item scope path. -type ItemScopePath string - -const ( - // ItemScopePathAnalyticsItems ... - ItemScopePathAnalyticsItems ItemScopePath = "analyticsItems" - // ItemScopePathMyanalyticsItems ... - ItemScopePathMyanalyticsItems ItemScopePath = "myanalyticsItems" -) - -// PossibleItemScopePathValues returns an array of possible values for the ItemScopePath const type. -func PossibleItemScopePathValues() []ItemScopePath { - return []ItemScopePath{ItemScopePathAnalyticsItems, ItemScopePathMyanalyticsItems} -} - -// ItemType enumerates the values for item type. -type ItemType string - -const ( - // ItemTypeFolder ... - ItemTypeFolder ItemType = "folder" - // ItemTypeFunction ... - ItemTypeFunction ItemType = "function" - // ItemTypeQuery ... - ItemTypeQuery ItemType = "query" - // ItemTypeRecent ... - ItemTypeRecent ItemType = "recent" -) - -// PossibleItemTypeValues returns an array of possible values for the ItemType const type. -func PossibleItemTypeValues() []ItemType { - return []ItemType{ItemTypeFolder, ItemTypeFunction, ItemTypeQuery, ItemTypeRecent} -} - -// ItemTypeParameter enumerates the values for item type parameter. -type ItemTypeParameter string - -const ( - // ItemTypeParameterFolder ... - ItemTypeParameterFolder ItemTypeParameter = "folder" - // ItemTypeParameterFunction ... - ItemTypeParameterFunction ItemTypeParameter = "function" - // ItemTypeParameterNone ... - ItemTypeParameterNone ItemTypeParameter = "none" - // ItemTypeParameterQuery ... - ItemTypeParameterQuery ItemTypeParameter = "query" - // ItemTypeParameterRecent ... - ItemTypeParameterRecent ItemTypeParameter = "recent" -) - -// PossibleItemTypeParameterValues returns an array of possible values for the ItemTypeParameter const type. -func PossibleItemTypeParameterValues() []ItemTypeParameter { - return []ItemTypeParameter{ItemTypeParameterFolder, ItemTypeParameterFunction, ItemTypeParameterNone, ItemTypeParameterQuery, ItemTypeParameterRecent} -} - -// PublicNetworkAccessType enumerates the values for public network access type. -type PublicNetworkAccessType string - -const ( - // PublicNetworkAccessTypeDisabled Disables public connectivity to Application Insights through public DNS. - PublicNetworkAccessTypeDisabled PublicNetworkAccessType = "Disabled" - // PublicNetworkAccessTypeEnabled Enables connectivity to Application Insights through public DNS. - PublicNetworkAccessTypeEnabled PublicNetworkAccessType = "Enabled" -) - -// PossiblePublicNetworkAccessTypeValues returns an array of possible values for the PublicNetworkAccessType const type. -func PossiblePublicNetworkAccessTypeValues() []PublicNetworkAccessType { - return []PublicNetworkAccessType{PublicNetworkAccessTypeDisabled, PublicNetworkAccessTypeEnabled} -} - -// PurgeState enumerates the values for purge state. -type PurgeState string - -const ( - // PurgeStateCompleted ... - PurgeStateCompleted PurgeState = "completed" - // PurgeStatePending ... - PurgeStatePending PurgeState = "pending" -) - -// PossiblePurgeStateValues returns an array of possible values for the PurgeState const type. -func PossiblePurgeStateValues() []PurgeState { - return []PurgeState{PurgeStateCompleted, PurgeStatePending} -} - -// RequestSource enumerates the values for request source. -type RequestSource string - -const ( - // RequestSourceRest ... - RequestSourceRest RequestSource = "rest" -) - -// PossibleRequestSourceValues returns an array of possible values for the RequestSource const type. -func PossibleRequestSourceValues() []RequestSource { - return []RequestSource{RequestSourceRest} -} - -// SharedTypeKind enumerates the values for shared type kind. -type SharedTypeKind string - -const ( - // SharedTypeKindShared ... - SharedTypeKindShared SharedTypeKind = "shared" - // SharedTypeKindUser ... - SharedTypeKindUser SharedTypeKind = "user" -) - -// PossibleSharedTypeKindValues returns an array of possible values for the SharedTypeKind const type. -func PossibleSharedTypeKindValues() []SharedTypeKind { - return []SharedTypeKind{SharedTypeKindShared, SharedTypeKindUser} -} - -// WebTestKind enumerates the values for web test kind. -type WebTestKind string - -const ( - // WebTestKindMultistep ... - WebTestKindMultistep WebTestKind = "multistep" - // WebTestKindPing ... - WebTestKindPing WebTestKind = "ping" -) - -// PossibleWebTestKindValues returns an array of possible values for the WebTestKind const type. -func PossibleWebTestKindValues() []WebTestKind { - return []WebTestKind{WebTestKindMultistep, WebTestKindPing} -} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/exportconfigurations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/exportconfigurations.go deleted file mode 100644 index 8543b8d411df..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/exportconfigurations.go +++ /dev/null @@ -1,471 +0,0 @@ -package insights - -// 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" -) - -// ExportConfigurationsClient is the composite Swagger for Application Insights Management Client -type ExportConfigurationsClient struct { - BaseClient -} - -// NewExportConfigurationsClient creates an instance of the ExportConfigurationsClient client. -func NewExportConfigurationsClient(subscriptionID string) ExportConfigurationsClient { - return NewExportConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewExportConfigurationsClientWithBaseURI creates an instance of the ExportConfigurationsClient 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 NewExportConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ExportConfigurationsClient { - return ExportConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a Continuous Export configuration of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// exportProperties - properties that need to be specified to create a Continuous Export configuration of a -// Application Insights component. -func (client ExportConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ApplicationInsightsComponentExportRequest) (result ListApplicationInsightsComponentExportConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Create") - 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("insights.ExportConfigurationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, exportProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client ExportConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportProperties ApplicationInsightsComponentExportRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", pathParameters), - autorest.WithJSON(exportProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client ExportConfigurationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client ExportConfigurationsClient) CreateResponder(resp *http.Response) (result ListApplicationInsightsComponentExportConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a Continuous Export configuration of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. -func (client ExportConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result ApplicationInsightsComponentExportConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Delete") - 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("insights.ExportConfigurationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, exportID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ExportConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportId": autorest.Encode("path", exportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", 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 ExportConfigurationsClient) 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 ExportConfigurationsClient) DeleteResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the Continuous Export configuration for this export id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. -func (client ExportConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result ApplicationInsightsComponentExportConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.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("insights.ExportConfigurationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, exportID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ExportConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportId": autorest.Encode("path", exportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", 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 ExportConfigurationsClient) 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 ExportConfigurationsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of Continuous Export configuration of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ExportConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListApplicationInsightsComponentExportConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.List") - 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("insights.ExportConfigurationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ExportConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ExportConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ExportConfigurationsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentExportConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update the Continuous Export configuration for this export id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// exportID - the Continuous Export configuration ID. This is unique within a Application Insights component. -// exportProperties - properties that need to be specified to update the Continuous Export configuration. -func (client ExportConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties ApplicationInsightsComponentExportRequest) (result ApplicationInsightsComponentExportConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ExportConfigurationsClient.Update") - 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("insights.ExportConfigurationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, exportID, exportProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ExportConfigurationsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ExportConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties ApplicationInsightsComponentExportRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "exportId": autorest.Encode("path", exportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/exportconfiguration/{exportId}", pathParameters), - autorest.WithJSON(exportProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ExportConfigurationsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ExportConfigurationsClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentExportConfiguration, 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/appinsights/mgmt/2020-02-02-preview/insights/favorites.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/favorites.go deleted file mode 100644 index 732fca754804..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/favorites.go +++ /dev/null @@ -1,497 +0,0 @@ -package insights - -// 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" -) - -// FavoritesClient is the composite Swagger for Application Insights Management Client -type FavoritesClient struct { - BaseClient -} - -// NewFavoritesClient creates an instance of the FavoritesClient client. -func NewFavoritesClient(subscriptionID string) FavoritesClient { - return NewFavoritesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewFavoritesClientWithBaseURI creates an instance of the FavoritesClient 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 NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string) FavoritesClient { - return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Add adds a new favorites to an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -// favoriteProperties - properties that need to be specified to create a new favorite and add it to an -// Application Insights component. -func (client FavoritesClient) Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Add") - 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("insights.FavoritesClient", "Add", err.Error()) - } - - req, err := client.AddPreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", nil, "Failure preparing request") - return - } - - resp, err := client.AddSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure sending request") - return - } - - result, err = client.AddResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure responding to request") - return - } - - return -} - -// AddPreparer prepares the Add request. -func (client FavoritesClient) AddPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - favoriteProperties.FavoriteID = nil - favoriteProperties.TimeModified = nil - favoriteProperties.UserID = 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.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), - autorest.WithJSON(favoriteProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// AddSender sends the Add request. The method will close the -// http.Response Body if it receives an error. -func (client FavoritesClient) AddSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// AddResponder handles the response to the Add request. The method always -// closes the http.Response Body. -func (client FavoritesClient) AddResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete remove a favorite that is associated to an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -func (client FavoritesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.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("insights.FavoritesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, favoriteID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client FavoritesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", 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 FavoritesClient) 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 FavoritesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a single favorite by its FavoriteId, defined within an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -func (client FavoritesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result ApplicationInsightsComponentFavorite, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.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("insights.FavoritesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, favoriteID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client FavoritesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", 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 FavoritesClient) 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 FavoritesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of favorites defined within an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// favoriteType - the type of favorite. Value can be either shared or user. -// sourceType - source type of favorite to return. When left out, the source type defaults to 'other' (not -// present in this enum). -// canFetchContent - flag indicating whether or not to return the full content for each applicable favorite. If -// false, only return summary content for favorites. -// tags - tags that must be present on each favorite returned. -func (client FavoritesClient) List(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []string) (result ListApplicationInsightsComponentFavorite, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.List") - 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("insights.FavoritesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client FavoritesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(string(favoriteType)) > 0 { - queryParameters["favoriteType"] = autorest.Encode("query", favoriteType) - } else { - queryParameters["favoriteType"] = autorest.Encode("query", "shared") - } - if len(string(sourceType)) > 0 { - queryParameters["sourceType"] = autorest.Encode("query", sourceType) - } - if canFetchContent != nil { - queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) - } - if tags != nil && len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags, ",") - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client FavoritesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client FavoritesClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentFavorite, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a favorite that has already been added to an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// favoriteID - the Id of a specific favorite defined in the Application Insights component -// favoriteProperties - properties that need to be specified to update the existing favorite. -func (client FavoritesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Update") - 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("insights.FavoritesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client FavoritesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "favoriteId": autorest.Encode("path", favoriteID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - favoriteProperties.FavoriteID = nil - favoriteProperties.TimeModified = nil - favoriteProperties.UserID = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters), - autorest.WithJSON(favoriteProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client FavoritesClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client FavoritesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, 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/appinsights/mgmt/2020-02-02-preview/insights/insightsapi/interfaces.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/insightsapi/interfaces.go deleted file mode 100644 index 2147306911a8..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/insightsapi/interfaces.go +++ /dev/null @@ -1,195 +0,0 @@ -package insightsapi - -// 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/azure-sdk-for-go/services/preview/appinsights/mgmt/2020-02-02-preview/insights" - "github.com/Azure/go-autorest/autorest" -) - -// OperationsClientAPI contains the set of methods on the OperationsClient type. -type OperationsClientAPI interface { - List(ctx context.Context) (result insights.OperationListResultPage, err error) - ListComplete(ctx context.Context) (result insights.OperationListResultIterator, err error) -} - -var _ OperationsClientAPI = (*insights.OperationsClient)(nil) - -// AnnotationsClientAPI contains the set of methods on the AnnotationsClient type. -type AnnotationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, resourceName string, annotationProperties insights.Annotation) (result insights.ListAnnotation, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string, annotationID string) (result insights.ListAnnotation, err error) - List(ctx context.Context, resourceGroupName string, resourceName string, start string, end string) (result insights.AnnotationsListResult, err error) -} - -var _ AnnotationsClientAPI = (*insights.AnnotationsClient)(nil) - -// APIKeysClientAPI contains the set of methods on the APIKeysClient type. -type APIKeysClientAPI interface { - Create(ctx context.Context, resourceGroupName string, resourceName string, APIKeyProperties insights.APIKeyRequest) (result insights.ApplicationInsightsComponentAPIKey, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result insights.ApplicationInsightsComponentAPIKey, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string, keyID string) (result insights.ApplicationInsightsComponentAPIKey, err error) - List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentAPIKeyListResult, err error) -} - -var _ APIKeysClientAPI = (*insights.APIKeysClient)(nil) - -// ExportConfigurationsClientAPI contains the set of methods on the ExportConfigurationsClient type. -type ExportConfigurationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, resourceName string, exportProperties insights.ApplicationInsightsComponentExportRequest) (result insights.ListApplicationInsightsComponentExportConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result insights.ApplicationInsightsComponentExportConfiguration, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string, exportID string) (result insights.ApplicationInsightsComponentExportConfiguration, err error) - List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ListApplicationInsightsComponentExportConfiguration, err error) - Update(ctx context.Context, resourceGroupName string, resourceName string, exportID string, exportProperties insights.ApplicationInsightsComponentExportRequest) (result insights.ApplicationInsightsComponentExportConfiguration, err error) -} - -var _ ExportConfigurationsClientAPI = (*insights.ExportConfigurationsClient)(nil) - -// ComponentCurrentBillingFeaturesClientAPI contains the set of methods on the ComponentCurrentBillingFeaturesClient type. -type ComponentCurrentBillingFeaturesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentBillingFeatures, err error) - Update(ctx context.Context, resourceGroupName string, resourceName string, billingFeaturesProperties insights.ApplicationInsightsComponentBillingFeatures) (result insights.ApplicationInsightsComponentBillingFeatures, err error) -} - -var _ ComponentCurrentBillingFeaturesClientAPI = (*insights.ComponentCurrentBillingFeaturesClient)(nil) - -// ComponentQuotaStatusClientAPI contains the set of methods on the ComponentQuotaStatusClient type. -type ComponentQuotaStatusClientAPI interface { - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentQuotaStatus, err error) -} - -var _ ComponentQuotaStatusClientAPI = (*insights.ComponentQuotaStatusClient)(nil) - -// ComponentFeatureCapabilitiesClientAPI contains the set of methods on the ComponentFeatureCapabilitiesClient type. -type ComponentFeatureCapabilitiesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentFeatureCapabilities, err error) -} - -var _ ComponentFeatureCapabilitiesClientAPI = (*insights.ComponentFeatureCapabilitiesClient)(nil) - -// ComponentAvailableFeaturesClientAPI contains the set of methods on the ComponentAvailableFeaturesClient type. -type ComponentAvailableFeaturesClientAPI interface { - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponentAvailableFeatures, err error) -} - -var _ ComponentAvailableFeaturesClientAPI = (*insights.ComponentAvailableFeaturesClient)(nil) - -// ProactiveDetectionConfigurationsClientAPI contains the set of methods on the ProactiveDetectionConfigurationsClient type. -type ProactiveDetectionConfigurationsClientAPI interface { - Get(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (result insights.ApplicationInsightsComponentProactiveDetectionConfiguration, err error) - List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) - Update(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties insights.ApplicationInsightsComponentProactiveDetectionConfiguration) (result insights.ApplicationInsightsComponentProactiveDetectionConfiguration, err error) -} - -var _ ProactiveDetectionConfigurationsClientAPI = (*insights.ProactiveDetectionConfigurationsClient)(nil) - -// WorkItemConfigurationsClientAPI contains the set of methods on the WorkItemConfigurationsClient type. -type WorkItemConfigurationsClientAPI interface { - Create(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties insights.WorkItemCreateConfiguration) (result insights.WorkItemConfiguration, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result autorest.Response, err error) - GetDefault(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkItemConfiguration, err error) - GetItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result insights.WorkItemConfiguration, err error) - List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.WorkItemConfigurationsListResult, err error) - UpdateItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties insights.WorkItemCreateConfiguration) (result insights.WorkItemConfiguration, err error) -} - -var _ WorkItemConfigurationsClientAPI = (*insights.WorkItemConfigurationsClient)(nil) - -// FavoritesClientAPI contains the set of methods on the FavoritesClient type. -type FavoritesClientAPI interface { - Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties insights.ApplicationInsightsComponentFavorite) (result insights.ApplicationInsightsComponentFavorite, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result insights.ApplicationInsightsComponentFavorite, err error) - List(ctx context.Context, resourceGroupName string, resourceName string, favoriteType insights.FavoriteType, sourceType insights.FavoriteSourceType, canFetchContent *bool, tags []string) (result insights.ListApplicationInsightsComponentFavorite, err error) - Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties insights.ApplicationInsightsComponentFavorite) (result insights.ApplicationInsightsComponentFavorite, err error) -} - -var _ FavoritesClientAPI = (*insights.FavoritesClient)(nil) - -// WebTestLocationsClientAPI contains the set of methods on the WebTestLocationsClient type. -type WebTestLocationsClientAPI interface { - List(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsWebTestLocationsListResult, err error) -} - -var _ WebTestLocationsClientAPI = (*insights.WebTestLocationsClient)(nil) - -// WebTestsClientAPI contains the set of methods on the WebTestsClient type. -type WebTestsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition insights.WebTest) (result insights.WebTest, err error) - Delete(ctx context.Context, resourceGroupName string, webTestName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, webTestName string) (result insights.WebTest, err error) - List(ctx context.Context) (result insights.WebTestListResultPage, err error) - ListComplete(ctx context.Context) (result insights.WebTestListResultIterator, err error) - ListByComponent(ctx context.Context, componentName string, resourceGroupName string) (result insights.WebTestListResultPage, err error) - ListByComponentComplete(ctx context.Context, componentName string, resourceGroupName string) (result insights.WebTestListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.WebTestListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.WebTestListResultIterator, err error) - UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags insights.TagsResource) (result insights.WebTest, err error) -} - -var _ WebTestsClientAPI = (*insights.WebTestsClient)(nil) - -// AnalyticsItemsClientAPI contains the set of methods on the AnalyticsItemsClient type. -type AnalyticsItemsClientAPI interface { - Delete(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, ID string, name string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, ID string, name string) (result insights.ApplicationInsightsComponentAnalyticsItem, err error) - List(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, scope insights.ItemScope, typeParameter insights.ItemTypeParameter, includeContent *bool) (result insights.ListApplicationInsightsComponentAnalyticsItem, err error) - Put(ctx context.Context, resourceGroupName string, resourceName string, scopePath insights.ItemScopePath, itemProperties insights.ApplicationInsightsComponentAnalyticsItem, overrideItem *bool) (result insights.ApplicationInsightsComponentAnalyticsItem, err error) -} - -var _ AnalyticsItemsClientAPI = (*insights.AnalyticsItemsClient)(nil) - -// WorkbooksClientAPI contains the set of methods on the WorkbooksClient type. -type WorkbooksClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.Workbook) (result insights.Workbook, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.Workbook, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.WorkbooksListResult, err error) - Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.Workbook) (result insights.Workbook, err error) -} - -var _ WorkbooksClientAPI = (*insights.WorkbooksClient)(nil) - -// MyWorkbooksClientAPI contains the set of methods on the MyWorkbooksClient type. -type MyWorkbooksClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.MyWorkbook) (result insights.MyWorkbook, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.MyWorkbook, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.MyWorkbooksListResult, err error) - ListBySubscription(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.MyWorkbooksListResult, err error) - Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.MyWorkbook) (result insights.MyWorkbook, err error) -} - -var _ MyWorkbooksClientAPI = (*insights.MyWorkbooksClient)(nil) - -// ComponentsClientAPI contains the set of methods on the ComponentsClient type. -type ComponentsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, insightProperties insights.ApplicationInsightsComponent) (result insights.ApplicationInsightsComponent, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ApplicationInsightsComponent, err error) - GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result insights.ComponentPurgeStatusResponse, err error) - List(ctx context.Context) (result insights.ApplicationInsightsComponentListResultPage, err error) - ListComplete(ctx context.Context) (result insights.ApplicationInsightsComponentListResultIterator, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string) (result insights.ApplicationInsightsComponentListResultPage, err error) - ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result insights.ApplicationInsightsComponentListResultIterator, err error) - Purge(ctx context.Context, resourceGroupName string, resourceName string, body insights.ComponentPurgeBody) (result insights.ComponentPurgeResponse, err error) - UpdateTags(ctx context.Context, resourceGroupName string, resourceName string, componentTags insights.TagsResource) (result insights.ApplicationInsightsComponent, err error) -} - -var _ ComponentsClientAPI = (*insights.ComponentsClient)(nil) - -// ComponentLinkedStorageAccountsClientAPI contains the set of methods on the ComponentLinkedStorageAccountsClient type. -type ComponentLinkedStorageAccountsClientAPI interface { - CreateAndUpdate(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties insights.ComponentLinkedStorageAccounts) (result insights.ComponentLinkedStorageAccounts, err error) - Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.ComponentLinkedStorageAccounts, err error) - Update(ctx context.Context, resourceGroupName string, resourceName string, linkedStorageAccountsProperties insights.ComponentLinkedStorageAccountsPatch) (result insights.ComponentLinkedStorageAccounts, err error) -} - -var _ ComponentLinkedStorageAccountsClientAPI = (*insights.ComponentLinkedStorageAccountsClient)(nil) diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/models.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/models.go deleted file mode 100644 index baea235a4143..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/models.go +++ /dev/null @@ -1,2376 +0,0 @@ -package insights - -// 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" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/appinsights/mgmt/2020-02-02-preview/insights" - -// Annotation annotation associated with an application insights resource. -type Annotation struct { - // AnnotationName - Name of annotation - AnnotationName *string `json:"AnnotationName,omitempty"` - // Category - Category of annotation, free form - Category *string `json:"Category,omitempty"` - // EventTime - Time when event occurred - EventTime *date.Time `json:"EventTime,omitempty"` - // ID - Unique Id for annotation - ID *string `json:"Id,omitempty"` - // Properties - Serialized JSON object for detailed properties - Properties *string `json:"Properties,omitempty"` - // RelatedAnnotation - Related parent annotation if any - RelatedAnnotation *string `json:"RelatedAnnotation,omitempty"` -} - -// AnnotationError error associated with trying to create annotation with Id that already exist -type AnnotationError struct { - // Code - Error detail code and explanation - Code *string `json:"code,omitempty"` - // Message - Error message - Message *string `json:"message,omitempty"` - Innererror *InnerError `json:"innererror,omitempty"` -} - -// AnnotationsListResult annotations list result. -type AnnotationsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; An array of annotations. - Value *[]Annotation `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for AnnotationsListResult. -func (alr AnnotationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// APIKeyRequest an Application Insights component API Key creation request definition. -type APIKeyRequest struct { - // Name - The name of the API Key. - Name *string `json:"name,omitempty"` - // LinkedReadProperties - The read access rights of this API Key. - LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` - // LinkedWriteProperties - The write access rights of this API Key. - LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` -} - -// ApplicationInsightsComponent an Application Insights component definition. -type ApplicationInsightsComponent struct { - autorest.Response `json:"-"` - // Kind - The kind of application that this component refers to, used to customize UI. This value is a freeform string, values should typically be one of the following: web, ios, other, store, java, phone. - Kind *string `json:"kind,omitempty"` - // Etag - Resource etag - Etag *string `json:"etag,omitempty"` - // ApplicationInsightsComponentProperties - Properties that define an Application Insights component resource. - *ApplicationInsightsComponentProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponent. -func (aic ApplicationInsightsComponent) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aic.Kind != nil { - objectMap["kind"] = aic.Kind - } - if aic.Etag != nil { - objectMap["etag"] = aic.Etag - } - if aic.ApplicationInsightsComponentProperties != nil { - objectMap["properties"] = aic.ApplicationInsightsComponentProperties - } - if aic.Location != nil { - objectMap["location"] = aic.Location - } - if aic.Tags != nil { - objectMap["tags"] = aic.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ApplicationInsightsComponent struct. -func (aic *ApplicationInsightsComponent) 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 "kind": - if v != nil { - var kind string - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - aic.Kind = &kind - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - aic.Etag = &etag - } - case "properties": - if v != nil { - var applicationInsightsComponentProperties ApplicationInsightsComponentProperties - err = json.Unmarshal(*v, &applicationInsightsComponentProperties) - if err != nil { - return err - } - aic.ApplicationInsightsComponentProperties = &applicationInsightsComponentProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - aic.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - aic.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - aic.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - aic.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - aic.Tags = tags - } - } - } - - return nil -} - -// ApplicationInsightsComponentAnalyticsItem properties that define an Analytics item that is associated to -// an Application Insights component. -type ApplicationInsightsComponentAnalyticsItem struct { - autorest.Response `json:"-"` - // ID - Internally assigned unique id of the item definition. - ID *string `json:"Id,omitempty"` - // Name - The user-defined name of the item. - Name *string `json:"Name,omitempty"` - // Content - The content of this item - Content *string `json:"Content,omitempty"` - // Version - READ-ONLY; This instance's version of the data model. This can change as new features are added. - Version *string `json:"Version,omitempty"` - // Scope - Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'ItemScopeShared', 'ItemScopeUser' - Scope ItemScope `json:"Scope,omitempty"` - // Type - Enum indicating the type of the Analytics item. Possible values include: 'ItemTypeQuery', 'ItemTypeFunction', 'ItemTypeFolder', 'ItemTypeRecent' - Type ItemType `json:"Type,omitempty"` - // TimeCreated - READ-ONLY; Date and time in UTC when this item was created. - TimeCreated *string `json:"TimeCreated,omitempty"` - // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this item. - TimeModified *string `json:"TimeModified,omitempty"` - Properties *ApplicationInsightsComponentAnalyticsItemProperties `json:"Properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAnalyticsItem. -func (aicai ApplicationInsightsComponentAnalyticsItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aicai.ID != nil { - objectMap["Id"] = aicai.ID - } - if aicai.Name != nil { - objectMap["Name"] = aicai.Name - } - if aicai.Content != nil { - objectMap["Content"] = aicai.Content - } - if aicai.Scope != "" { - objectMap["Scope"] = aicai.Scope - } - if aicai.Type != "" { - objectMap["Type"] = aicai.Type - } - if aicai.Properties != nil { - objectMap["Properties"] = aicai.Properties - } - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentAnalyticsItemProperties a set of properties that can be defined in the -// context of a specific item type. Each type may have its own properties. -type ApplicationInsightsComponentAnalyticsItemProperties struct { - // FunctionAlias - A function alias, used when the type of the item is Function - FunctionAlias *string `json:"functionAlias,omitempty"` -} - -// ApplicationInsightsComponentAPIKey properties that define an API key of an Application Insights -// Component. -type ApplicationInsightsComponentAPIKey struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; The unique ID of the API key inside an Application Insights component. It is auto generated when the API key is created. - ID *string `json:"id,omitempty"` - // APIKey - READ-ONLY; The API key value. It will be only return once when the API Key was created. - APIKey *string `json:"apiKey,omitempty"` - // CreatedDate - The create date of this API key. - CreatedDate *string `json:"createdDate,omitempty"` - // Name - The name of the API key. - Name *string `json:"name,omitempty"` - // LinkedReadProperties - The read access rights of this API Key. - LinkedReadProperties *[]string `json:"linkedReadProperties,omitempty"` - // LinkedWriteProperties - The write access rights of this API Key. - LinkedWriteProperties *[]string `json:"linkedWriteProperties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAPIKey. -func (aicak ApplicationInsightsComponentAPIKey) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aicak.CreatedDate != nil { - objectMap["createdDate"] = aicak.CreatedDate - } - if aicak.Name != nil { - objectMap["name"] = aicak.Name - } - if aicak.LinkedReadProperties != nil { - objectMap["linkedReadProperties"] = aicak.LinkedReadProperties - } - if aicak.LinkedWriteProperties != nil { - objectMap["linkedWriteProperties"] = aicak.LinkedWriteProperties - } - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentAPIKeyListResult describes the list of API Keys of an Application Insights -// Component. -type ApplicationInsightsComponentAPIKeyListResult struct { - autorest.Response `json:"-"` - // Value - List of API Key definitions. - Value *[]ApplicationInsightsComponentAPIKey `json:"value,omitempty"` -} - -// ApplicationInsightsComponentAvailableFeatures an Application Insights component available features. -type ApplicationInsightsComponentAvailableFeatures struct { - autorest.Response `json:"-"` - // Result - READ-ONLY; A list of Application Insights component feature. - Result *[]ApplicationInsightsComponentFeature `json:"Result,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentAvailableFeatures. -func (aicaf ApplicationInsightsComponentAvailableFeatures) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentBillingFeatures an Application Insights component billing features -type ApplicationInsightsComponentBillingFeatures struct { - autorest.Response `json:"-"` - // DataVolumeCap - An Application Insights component daily data volume cap - DataVolumeCap *ApplicationInsightsComponentDataVolumeCap `json:"DataVolumeCap,omitempty"` - // CurrentBillingFeatures - Current enabled pricing plan. When the component is in the Enterprise plan, this will list both 'Basic' and 'Application Insights Enterprise'. - CurrentBillingFeatures *[]string `json:"CurrentBillingFeatures,omitempty"` -} - -// ApplicationInsightsComponentDataVolumeCap an Application Insights component daily data volume cap -type ApplicationInsightsComponentDataVolumeCap struct { - // Cap - Daily data volume cap in GB. - Cap *float64 `json:"Cap,omitempty"` - // ResetTime - READ-ONLY; Daily data volume cap UTC reset hour. - ResetTime *int32 `json:"ResetTime,omitempty"` - // WarningThreshold - Reserved, not used for now. - WarningThreshold *int32 `json:"WarningThreshold,omitempty"` - // StopSendNotificationWhenHitThreshold - Reserved, not used for now. - StopSendNotificationWhenHitThreshold *bool `json:"StopSendNotificationWhenHitThreshold,omitempty"` - // StopSendNotificationWhenHitCap - Do not send a notification email when the daily data volume cap is met. - StopSendNotificationWhenHitCap *bool `json:"StopSendNotificationWhenHitCap,omitempty"` - // MaxHistoryCap - READ-ONLY; Maximum daily data volume cap that the user can set for this component. - MaxHistoryCap *float64 `json:"MaxHistoryCap,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentDataVolumeCap. -func (aicdvc ApplicationInsightsComponentDataVolumeCap) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aicdvc.Cap != nil { - objectMap["Cap"] = aicdvc.Cap - } - if aicdvc.WarningThreshold != nil { - objectMap["WarningThreshold"] = aicdvc.WarningThreshold - } - if aicdvc.StopSendNotificationWhenHitThreshold != nil { - objectMap["StopSendNotificationWhenHitThreshold"] = aicdvc.StopSendNotificationWhenHitThreshold - } - if aicdvc.StopSendNotificationWhenHitCap != nil { - objectMap["StopSendNotificationWhenHitCap"] = aicdvc.StopSendNotificationWhenHitCap - } - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentExportConfiguration properties that define a Continuous Export -// configuration. -type ApplicationInsightsComponentExportConfiguration struct { - autorest.Response `json:"-"` - // ExportID - READ-ONLY; The unique ID of the export configuration inside an Application Insights component. It is auto generated when the Continuous Export configuration is created. - ExportID *string `json:"ExportId,omitempty"` - // InstrumentationKey - READ-ONLY; The instrumentation key of the Application Insights component. - InstrumentationKey *string `json:"InstrumentationKey,omitempty"` - // RecordTypes - This comma separated list of document types that will be exported. The possible values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. - RecordTypes *string `json:"RecordTypes,omitempty"` - // ApplicationName - READ-ONLY; The name of the Application Insights component. - ApplicationName *string `json:"ApplicationName,omitempty"` - // SubscriptionID - READ-ONLY; The subscription of the Application Insights component. - SubscriptionID *string `json:"SubscriptionId,omitempty"` - // ResourceGroup - READ-ONLY; The resource group of the Application Insights component. - ResourceGroup *string `json:"ResourceGroup,omitempty"` - // DestinationStorageSubscriptionID - READ-ONLY; The destination storage account subscription ID. - DestinationStorageSubscriptionID *string `json:"DestinationStorageSubscriptionId,omitempty"` - // DestinationStorageLocationID - READ-ONLY; The destination account location ID. - DestinationStorageLocationID *string `json:"DestinationStorageLocationId,omitempty"` - // DestinationAccountID - READ-ONLY; The name of destination account. - DestinationAccountID *string `json:"DestinationAccountId,omitempty"` - // DestinationType - READ-ONLY; The destination type. - DestinationType *string `json:"DestinationType,omitempty"` - // IsUserEnabled - READ-ONLY; This will be 'true' if the Continuous Export configuration is enabled, otherwise it will be 'false'. - IsUserEnabled *string `json:"IsUserEnabled,omitempty"` - // LastUserUpdate - READ-ONLY; Last time the Continuous Export configuration was updated. - LastUserUpdate *string `json:"LastUserUpdate,omitempty"` - // NotificationQueueEnabled - Deprecated - NotificationQueueEnabled *string `json:"NotificationQueueEnabled,omitempty"` - // ExportStatus - READ-ONLY; This indicates current Continuous Export configuration status. The possible values are 'Preparing', 'Success', 'Failure'. - ExportStatus *string `json:"ExportStatus,omitempty"` - // LastSuccessTime - READ-ONLY; The last time data was successfully delivered to the destination storage container for this Continuous Export configuration. - LastSuccessTime *string `json:"LastSuccessTime,omitempty"` - // LastGapTime - READ-ONLY; The last time the Continuous Export configuration started failing. - LastGapTime *string `json:"LastGapTime,omitempty"` - // PermanentErrorReason - READ-ONLY; This is the reason the Continuous Export configuration started failing. It can be 'AzureStorageNotFound' or 'AzureStorageAccessDenied'. - PermanentErrorReason *string `json:"PermanentErrorReason,omitempty"` - // StorageName - READ-ONLY; The name of the destination storage account. - StorageName *string `json:"StorageName,omitempty"` - // ContainerName - READ-ONLY; The name of the destination storage container. - ContainerName *string `json:"ContainerName,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentExportConfiguration. -func (aicec ApplicationInsightsComponentExportConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aicec.RecordTypes != nil { - objectMap["RecordTypes"] = aicec.RecordTypes - } - if aicec.NotificationQueueEnabled != nil { - objectMap["NotificationQueueEnabled"] = aicec.NotificationQueueEnabled - } - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentExportRequest an Application Insights component Continuous Export -// configuration request definition. -type ApplicationInsightsComponentExportRequest struct { - // RecordTypes - The document types to be exported, as comma separated values. Allowed values include 'Requests', 'Event', 'Exceptions', 'Metrics', 'PageViews', 'PageViewPerformance', 'Rdd', 'PerformanceCounters', 'Availability', 'Messages'. - RecordTypes *string `json:"RecordTypes,omitempty"` - // DestinationType - The Continuous Export destination type. This has to be 'Blob'. - DestinationType *string `json:"DestinationType,omitempty"` - // DestinationAddress - The SAS URL for the destination storage container. It must grant write permission. - DestinationAddress *string `json:"DestinationAddress,omitempty"` - // IsEnabled - Set to 'true' to create a Continuous Export configuration as enabled, otherwise set it to 'false'. - IsEnabled *string `json:"IsEnabled,omitempty"` - // NotificationQueueEnabled - Deprecated - NotificationQueueEnabled *string `json:"NotificationQueueEnabled,omitempty"` - // NotificationQueueURI - Deprecated - NotificationQueueURI *string `json:"NotificationQueueUri,omitempty"` - // DestinationStorageSubscriptionID - The subscription ID of the destination storage container. - DestinationStorageSubscriptionID *string `json:"DestinationStorageSubscriptionId,omitempty"` - // DestinationStorageLocationID - The location ID of the destination storage container. - DestinationStorageLocationID *string `json:"DestinationStorageLocationId,omitempty"` - // DestinationAccountID - The name of destination storage account. - DestinationAccountID *string `json:"DestinationAccountId,omitempty"` -} - -// ApplicationInsightsComponentFavorite properties that define a favorite that is associated to an -// Application Insights component. -type ApplicationInsightsComponentFavorite struct { - autorest.Response `json:"-"` - // Name - The user-defined name of the favorite. - Name *string `json:"Name,omitempty"` - // Config - Configuration of this particular favorite, which are driven by the Azure portal UX. Configuration data is a string containing valid JSON - Config *string `json:"Config,omitempty"` - // Version - This instance's version of the data model. This can change as new features are added that can be marked favorite. Current examples include MetricsExplorer (ME) and Search. - Version *string `json:"Version,omitempty"` - // FavoriteID - READ-ONLY; Internally assigned unique id of the favorite definition. - FavoriteID *string `json:"FavoriteId,omitempty"` - // FavoriteType - Enum indicating if this favorite definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'FavoriteTypeShared', 'FavoriteTypeUser' - FavoriteType FavoriteType `json:"FavoriteType,omitempty"` - // SourceType - The source of the favorite definition. - SourceType *string `json:"SourceType,omitempty"` - // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this favorite definition. - TimeModified *string `json:"TimeModified,omitempty"` - // Tags - A list of 0 or more tags that are associated with this favorite definition - Tags *[]string `json:"Tags,omitempty"` - // Category - Favorite category, as defined by the user at creation time. - Category *string `json:"Category,omitempty"` - // IsGeneratedFromTemplate - Flag denoting wether or not this favorite was generated from a template. - IsGeneratedFromTemplate *bool `json:"IsGeneratedFromTemplate,omitempty"` - // UserID - READ-ONLY; Unique user id of the specific user that owns this favorite. - UserID *string `json:"UserId,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFavorite. -func (aicf ApplicationInsightsComponentFavorite) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aicf.Name != nil { - objectMap["Name"] = aicf.Name - } - if aicf.Config != nil { - objectMap["Config"] = aicf.Config - } - if aicf.Version != nil { - objectMap["Version"] = aicf.Version - } - if aicf.FavoriteType != "" { - objectMap["FavoriteType"] = aicf.FavoriteType - } - if aicf.SourceType != nil { - objectMap["SourceType"] = aicf.SourceType - } - if aicf.Tags != nil { - objectMap["Tags"] = aicf.Tags - } - if aicf.Category != nil { - objectMap["Category"] = aicf.Category - } - if aicf.IsGeneratedFromTemplate != nil { - objectMap["IsGeneratedFromTemplate"] = aicf.IsGeneratedFromTemplate - } - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentFeature an Application Insights component daily data volume cap status -type ApplicationInsightsComponentFeature struct { - // FeatureName - READ-ONLY; The pricing feature name. - FeatureName *string `json:"FeatureName,omitempty"` - // MeterID - READ-ONLY; The meter id used for the feature. - MeterID *string `json:"MeterId,omitempty"` - // MeterRateFrequency - READ-ONLY; The meter rate for the feature's meter. - MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` - // ResouceID - READ-ONLY; Reserved, not used now. - ResouceID *string `json:"ResouceId,omitempty"` - // IsHidden - READ-ONLY; Reserved, not used now. - IsHidden *bool `json:"IsHidden,omitempty"` - // Capabilities - READ-ONLY; A list of Application Insights component feature capability. - Capabilities *[]ApplicationInsightsComponentFeatureCapability `json:"Capabilities,omitempty"` - // Title - READ-ONLY; Display name of the feature. - Title *string `json:"Title,omitempty"` - // IsMainFeature - READ-ONLY; Whether can apply addon feature on to it. - IsMainFeature *bool `json:"IsMainFeature,omitempty"` - // SupportedAddonFeatures - READ-ONLY; The add on features on main feature. - SupportedAddonFeatures *string `json:"SupportedAddonFeatures,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeature. -func (aicf ApplicationInsightsComponentFeature) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentFeatureCapabilities an Application Insights component feature capabilities -type ApplicationInsightsComponentFeatureCapabilities struct { - autorest.Response `json:"-"` - // SupportExportData - READ-ONLY; Whether allow to use continuous export feature. - SupportExportData *bool `json:"SupportExportData,omitempty"` - // BurstThrottlePolicy - READ-ONLY; Reserved, not used now. - BurstThrottlePolicy *string `json:"BurstThrottlePolicy,omitempty"` - // MetadataClass - READ-ONLY; Reserved, not used now. - MetadataClass *string `json:"MetadataClass,omitempty"` - // LiveStreamMetrics - READ-ONLY; Reserved, not used now. - LiveStreamMetrics *bool `json:"LiveStreamMetrics,omitempty"` - // ApplicationMap - READ-ONLY; Reserved, not used now. - ApplicationMap *bool `json:"ApplicationMap,omitempty"` - // WorkItemIntegration - READ-ONLY; Whether allow to use work item integration feature. - WorkItemIntegration *bool `json:"WorkItemIntegration,omitempty"` - // PowerBIIntegration - READ-ONLY; Reserved, not used now. - PowerBIIntegration *bool `json:"PowerBIIntegration,omitempty"` - // OpenSchema - READ-ONLY; Reserved, not used now. - OpenSchema *bool `json:"OpenSchema,omitempty"` - // ProactiveDetection - READ-ONLY; Reserved, not used now. - ProactiveDetection *bool `json:"ProactiveDetection,omitempty"` - // AnalyticsIntegration - READ-ONLY; Reserved, not used now. - AnalyticsIntegration *bool `json:"AnalyticsIntegration,omitempty"` - // MultipleStepWebTest - READ-ONLY; Whether allow to use multiple steps web test feature. - MultipleStepWebTest *bool `json:"MultipleStepWebTest,omitempty"` - // APIAccessLevel - READ-ONLY; Reserved, not used now. - APIAccessLevel *string `json:"ApiAccessLevel,omitempty"` - // TrackingType - READ-ONLY; The application insights component used tracking type. - TrackingType *string `json:"TrackingType,omitempty"` - // DailyCap - READ-ONLY; Daily data volume cap in GB. - DailyCap *float64 `json:"DailyCap,omitempty"` - // DailyCapResetTime - READ-ONLY; Daily data volume cap UTC reset hour. - DailyCapResetTime *float64 `json:"DailyCapResetTime,omitempty"` - // ThrottleRate - READ-ONLY; Reserved, not used now. - ThrottleRate *float64 `json:"ThrottleRate,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeatureCapabilities. -func (aicfc ApplicationInsightsComponentFeatureCapabilities) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentFeatureCapability an Application Insights component feature capability -type ApplicationInsightsComponentFeatureCapability struct { - // Name - READ-ONLY; The name of the capability. - Name *string `json:"Name,omitempty"` - // Description - READ-ONLY; The description of the capability. - Description *string `json:"Description,omitempty"` - // Value - READ-ONLY; The value of the capability. - Value *string `json:"Value,omitempty"` - // Unit - READ-ONLY; The unit of the capability. - Unit *string `json:"Unit,omitempty"` - // MeterID - READ-ONLY; The meter used for the capability. - MeterID *string `json:"MeterId,omitempty"` - // MeterRateFrequency - READ-ONLY; The meter rate of the meter. - MeterRateFrequency *string `json:"MeterRateFrequency,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentFeatureCapability. -func (aicfc ApplicationInsightsComponentFeatureCapability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentListResult describes the list of Application Insights Resources. -type ApplicationInsightsComponentListResult struct { - autorest.Response `json:"-"` - // Value - List of Application Insights component definitions. - Value *[]ApplicationInsightsComponent `json:"value,omitempty"` - // NextLink - The URI to get the next set of Application Insights component definitions if too many components where returned in the result set. - NextLink *string `json:"nextLink,omitempty"` -} - -// ApplicationInsightsComponentListResultIterator provides access to a complete listing of -// ApplicationInsightsComponent values. -type ApplicationInsightsComponentListResultIterator struct { - i int - page ApplicationInsightsComponentListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *ApplicationInsightsComponentListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationInsightsComponentListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *ApplicationInsightsComponentListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ApplicationInsightsComponentListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter ApplicationInsightsComponentListResultIterator) Response() ApplicationInsightsComponentListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter ApplicationInsightsComponentListResultIterator) Value() ApplicationInsightsComponent { - if !iter.page.NotDone() { - return ApplicationInsightsComponent{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ApplicationInsightsComponentListResultIterator type. -func NewApplicationInsightsComponentListResultIterator(page ApplicationInsightsComponentListResultPage) ApplicationInsightsComponentListResultIterator { - return ApplicationInsightsComponentListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (aiclr ApplicationInsightsComponentListResult) IsEmpty() bool { - return aiclr.Value == nil || len(*aiclr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (aiclr ApplicationInsightsComponentListResult) hasNextLink() bool { - return aiclr.NextLink != nil && len(*aiclr.NextLink) != 0 -} - -// applicationInsightsComponentListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (aiclr ApplicationInsightsComponentListResult) applicationInsightsComponentListResultPreparer(ctx context.Context) (*http.Request, error) { - if !aiclr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(aiclr.NextLink))) -} - -// ApplicationInsightsComponentListResultPage contains a page of ApplicationInsightsComponent values. -type ApplicationInsightsComponentListResultPage struct { - fn func(context.Context, ApplicationInsightsComponentListResult) (ApplicationInsightsComponentListResult, error) - aiclr ApplicationInsightsComponentListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *ApplicationInsightsComponentListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationInsightsComponentListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.aiclr) - if err != nil { - return err - } - page.aiclr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *ApplicationInsightsComponentListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ApplicationInsightsComponentListResultPage) NotDone() bool { - return !page.aiclr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ApplicationInsightsComponentListResultPage) Response() ApplicationInsightsComponentListResult { - return page.aiclr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ApplicationInsightsComponentListResultPage) Values() []ApplicationInsightsComponent { - if page.aiclr.IsEmpty() { - return nil - } - return *page.aiclr.Value -} - -// Creates a new instance of the ApplicationInsightsComponentListResultPage type. -func NewApplicationInsightsComponentListResultPage(cur ApplicationInsightsComponentListResult, getNextPage func(context.Context, ApplicationInsightsComponentListResult) (ApplicationInsightsComponentListResult, error)) ApplicationInsightsComponentListResultPage { - return ApplicationInsightsComponentListResultPage{ - fn: getNextPage, - aiclr: cur, - } -} - -// ApplicationInsightsComponentProactiveDetectionConfiguration properties that define a ProactiveDetection -// configuration. -type ApplicationInsightsComponentProactiveDetectionConfiguration struct { - autorest.Response `json:"-"` - // Name - The rule name - Name *string `json:"Name,omitempty"` - // Enabled - A flag that indicates whether this rule is enabled by the user - Enabled *bool `json:"Enabled,omitempty"` - // SendEmailsToSubscriptionOwners - A flag that indicated whether notifications on this rule should be sent to subscription owners - SendEmailsToSubscriptionOwners *bool `json:"SendEmailsToSubscriptionOwners,omitempty"` - // CustomEmails - Custom email addresses for this rule notifications - CustomEmails *[]string `json:"CustomEmails,omitempty"` - // LastUpdatedTime - The last time this rule was updated - LastUpdatedTime *string `json:"LastUpdatedTime,omitempty"` - // RuleDefinitions - Static definitions of the ProactiveDetection configuration rule (same values for all components). - RuleDefinitions *ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions `json:"RuleDefinitions,omitempty"` -} - -// ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions static definitions of the -// ProactiveDetection configuration rule (same values for all components). -type ApplicationInsightsComponentProactiveDetectionConfigurationRuleDefinitions struct { - // Name - The rule name - Name *string `json:"Name,omitempty"` - // DisplayName - The rule name as it is displayed in UI - DisplayName *string `json:"DisplayName,omitempty"` - // Description - The rule description - Description *string `json:"Description,omitempty"` - // HelpURL - URL which displays additional info about the proactive detection rule - HelpURL *string `json:"HelpUrl,omitempty"` - // IsHidden - A flag indicating whether the rule is hidden (from the UI) - IsHidden *bool `json:"IsHidden,omitempty"` - // IsEnabledByDefault - A flag indicating whether the rule is enabled by default - IsEnabledByDefault *bool `json:"IsEnabledByDefault,omitempty"` - // IsInPreview - A flag indicating whether the rule is in preview - IsInPreview *bool `json:"IsInPreview,omitempty"` - // SupportsEmailNotifications - A flag indicating whether email notifications are supported for detections for this rule - SupportsEmailNotifications *bool `json:"SupportsEmailNotifications,omitempty"` -} - -// ApplicationInsightsComponentProperties properties that define an Application Insights component -// resource. -type ApplicationInsightsComponentProperties struct { - // ApplicationID - READ-ONLY; The unique ID of your application. This field mirrors the 'Name' field and cannot be changed. - ApplicationID *string `json:"ApplicationId,omitempty"` - // AppID - READ-ONLY; Application Insights Unique ID for your Application. - AppID *string `json:"AppId,omitempty"` - // Name - READ-ONLY; Application name. - Name *string `json:"Name,omitempty"` - // ApplicationType - Type of application being monitored. Possible values include: 'ApplicationTypeWeb', 'ApplicationTypeOther' - ApplicationType ApplicationType `json:"Application_Type,omitempty"` - // FlowType - Used by the Application Insights system to determine what kind of flow this component was created by. This is to be set to 'Bluefield' when creating/updating a component via the REST API. Possible values include: 'FlowTypeBluefield' - FlowType FlowType `json:"Flow_Type,omitempty"` - // RequestSource - Describes what tool created this Application Insights component. Customers using this API should set this to the default 'rest'. Possible values include: 'RequestSourceRest' - RequestSource RequestSource `json:"Request_Source,omitempty"` - // InstrumentationKey - READ-ONLY; Application Insights Instrumentation key. A read-only value that applications can use to identify the destination for all telemetry sent to Azure Application Insights. This value will be supplied upon construction of each new Application Insights component. - InstrumentationKey *string `json:"InstrumentationKey,omitempty"` - // CreationDate - READ-ONLY; Creation Date for the Application Insights component, in ISO 8601 format. - CreationDate *date.Time `json:"CreationDate,omitempty"` - // TenantID - READ-ONLY; Azure Tenant Id. - TenantID *string `json:"TenantId,omitempty"` - // HockeyAppID - The unique application ID created when a new application is added to HockeyApp, used for communications with HockeyApp. - HockeyAppID *string `json:"HockeyAppId,omitempty"` - // HockeyAppToken - READ-ONLY; Token used to authenticate communications with between Application Insights and HockeyApp. - HockeyAppToken *string `json:"HockeyAppToken,omitempty"` - // ProvisioningState - READ-ONLY; Current state of this component: whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - ProvisioningState *string `json:"provisioningState,omitempty"` - // SamplingPercentage - Percentage of the data produced by the application being monitored that is being sampled for Application Insights telemetry. - SamplingPercentage *float64 `json:"SamplingPercentage,omitempty"` - // ConnectionString - READ-ONLY; Application Insights component connection string. - ConnectionString *string `json:"ConnectionString,omitempty"` - // RetentionInDays - READ-ONLY; Retention period in days. - RetentionInDays *int32 `json:"RetentionInDays,omitempty"` - // DisableIPMasking - Disable IP masking. - DisableIPMasking *bool `json:"DisableIpMasking,omitempty"` - // ImmediatePurgeDataOn30Days - Purge data immediately after 30 days. - ImmediatePurgeDataOn30Days *bool `json:"ImmediatePurgeDataOn30Days,omitempty"` - // WorkspaceResourceID - Resource Id of the log analytics workspace which the data will be ingested to. This property is required to create an application with this API version. Applications from older versions will not have this property. - WorkspaceResourceID *string `json:"WorkspaceResourceId,omitempty"` - // LaMigrationDate - READ-ONLY; The date which the component got migrated to LA, in ISO 8601 format. - LaMigrationDate *date.Time `json:"LaMigrationDate,omitempty"` - // PrivateLinkScopedResources - READ-ONLY; List of linked private link scope resources. - PrivateLinkScopedResources *[]PrivateLinkScopedResource `json:"PrivateLinkScopedResources,omitempty"` - // PublicNetworkAccessForIngestion - The network access type for accessing Application Insights ingestion. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccessForIngestion PublicNetworkAccessType `json:"publicNetworkAccessForIngestion,omitempty"` - // PublicNetworkAccessForQuery - The network access type for accessing Application Insights query. Possible values include: 'PublicNetworkAccessTypeEnabled', 'PublicNetworkAccessTypeDisabled' - PublicNetworkAccessForQuery PublicNetworkAccessType `json:"publicNetworkAccessForQuery,omitempty"` - // IngestionMode - Indicates the flow of the ingestion. Possible values include: 'IngestionModeApplicationInsights', 'IngestionModeApplicationInsightsWithDiagnosticSettings', 'IngestionModeLogAnalytics' - IngestionMode IngestionMode `json:"IngestionMode,omitempty"` - // DisableLocalAuth - Disable Non-AAD based Auth. - DisableLocalAuth *bool `json:"DisableLocalAuth,omitempty"` - // ForceCustomerStorageForProfiler - Force users to create their own storage account for profiler and debugger. - ForceCustomerStorageForProfiler *bool `json:"ForceCustomerStorageForProfiler,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentProperties. -func (aicp ApplicationInsightsComponentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if aicp.ApplicationType != "" { - objectMap["Application_Type"] = aicp.ApplicationType - } - if aicp.FlowType != "" { - objectMap["Flow_Type"] = aicp.FlowType - } - if aicp.RequestSource != "" { - objectMap["Request_Source"] = aicp.RequestSource - } - if aicp.HockeyAppID != nil { - objectMap["HockeyAppId"] = aicp.HockeyAppID - } - if aicp.SamplingPercentage != nil { - objectMap["SamplingPercentage"] = aicp.SamplingPercentage - } - if aicp.DisableIPMasking != nil { - objectMap["DisableIpMasking"] = aicp.DisableIPMasking - } - if aicp.ImmediatePurgeDataOn30Days != nil { - objectMap["ImmediatePurgeDataOn30Days"] = aicp.ImmediatePurgeDataOn30Days - } - if aicp.WorkspaceResourceID != nil { - objectMap["WorkspaceResourceId"] = aicp.WorkspaceResourceID - } - if aicp.PublicNetworkAccessForIngestion != "" { - objectMap["publicNetworkAccessForIngestion"] = aicp.PublicNetworkAccessForIngestion - } - if aicp.PublicNetworkAccessForQuery != "" { - objectMap["publicNetworkAccessForQuery"] = aicp.PublicNetworkAccessForQuery - } - if aicp.IngestionMode != "" { - objectMap["IngestionMode"] = aicp.IngestionMode - } - if aicp.DisableLocalAuth != nil { - objectMap["DisableLocalAuth"] = aicp.DisableLocalAuth - } - if aicp.ForceCustomerStorageForProfiler != nil { - objectMap["ForceCustomerStorageForProfiler"] = aicp.ForceCustomerStorageForProfiler - } - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentQuotaStatus an Application Insights component daily data volume cap status -type ApplicationInsightsComponentQuotaStatus struct { - autorest.Response `json:"-"` - // AppID - READ-ONLY; The Application ID for the Application Insights component. - AppID *string `json:"AppId,omitempty"` - // ShouldBeThrottled - READ-ONLY; The daily data volume cap is met, and data ingestion will be stopped. - ShouldBeThrottled *bool `json:"ShouldBeThrottled,omitempty"` - // ExpirationTime - READ-ONLY; Date and time when the daily data volume cap will be reset, and data ingestion will resume. - ExpirationTime *string `json:"ExpirationTime,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentQuotaStatus. -func (aicqs ApplicationInsightsComponentQuotaStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationInsightsComponentWebTestLocation properties that define a web test location available to an -// Application Insights Component. -type ApplicationInsightsComponentWebTestLocation struct { - // DisplayName - READ-ONLY; The display name of the web test location. - DisplayName *string `json:"DisplayName,omitempty"` - // Tag - READ-ONLY; Internally defined geographic location tag. - Tag *string `json:"Tag,omitempty"` -} - -// MarshalJSON is the custom marshaler for ApplicationInsightsComponentWebTestLocation. -func (aicwtl ApplicationInsightsComponentWebTestLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ApplicationInsightsWebTestLocationsListResult describes the list of web test locations available to an -// Application Insights Component. -type ApplicationInsightsWebTestLocationsListResult struct { - autorest.Response `json:"-"` - // Value - List of web test locations. - Value *[]ApplicationInsightsComponentWebTestLocation `json:"value,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,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 AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ComponentLinkedStorageAccounts an Application Insights component linked storage accounts -type ComponentLinkedStorageAccounts struct { - autorest.Response `json:"-"` - // LinkedStorageAccountsProperties - The properties of the linked storage accounts. - *LinkedStorageAccountsProperties `json:"properties,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 ComponentLinkedStorageAccounts. -func (clsa ComponentLinkedStorageAccounts) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if clsa.LinkedStorageAccountsProperties != nil { - objectMap["properties"] = clsa.LinkedStorageAccountsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ComponentLinkedStorageAccounts struct. -func (clsa *ComponentLinkedStorageAccounts) 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 linkedStorageAccountsProperties LinkedStorageAccountsProperties - err = json.Unmarshal(*v, &linkedStorageAccountsProperties) - if err != nil { - return err - } - clsa.LinkedStorageAccountsProperties = &linkedStorageAccountsProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - clsa.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - clsa.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - clsa.Type = &typeVar - } - } - } - - return nil -} - -// ComponentLinkedStorageAccountsPatch an Application Insights component linked storage accounts patch -type ComponentLinkedStorageAccountsPatch struct { - // LinkedStorageAccountsProperties - The properties of the linked storage accounts. - *LinkedStorageAccountsProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for ComponentLinkedStorageAccountsPatch. -func (clsap ComponentLinkedStorageAccountsPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if clsap.LinkedStorageAccountsProperties != nil { - objectMap["properties"] = clsap.LinkedStorageAccountsProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ComponentLinkedStorageAccountsPatch struct. -func (clsap *ComponentLinkedStorageAccountsPatch) 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 linkedStorageAccountsProperties LinkedStorageAccountsProperties - err = json.Unmarshal(*v, &linkedStorageAccountsProperties) - if err != nil { - return err - } - clsap.LinkedStorageAccountsProperties = &linkedStorageAccountsProperties - } - } - } - - return nil -} - -// ComponentPurgeBody describes the body of a purge request for an App Insights component -type ComponentPurgeBody struct { - // Table - Table from which to purge data. - Table *string `json:"table,omitempty"` - // Filters - The set of columns and filters (queries) to run over them to purge the resulting data. - Filters *[]ComponentPurgeBodyFilters `json:"filters,omitempty"` -} - -// ComponentPurgeBodyFilters user-defined filters to return data which will be purged from the table. -type ComponentPurgeBodyFilters struct { - // Column - The column of the table over which the given query should run - Column *string `json:"column,omitempty"` - // Operator - A query operator to evaluate over the provided column and value(s). Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query. - Operator *string `json:"operator,omitempty"` - // Value - the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values. - Value interface{} `json:"value,omitempty"` - // Key - When filtering over custom dimensions, this key will be used as the name of the custom dimension. - Key *string `json:"key,omitempty"` -} - -// ComponentPurgeResponse response containing operationId for a specific purge action. -type ComponentPurgeResponse struct { - autorest.Response `json:"-"` - // OperationID - Id to use when querying for status for a particular purge operation. - OperationID *string `json:"operationId,omitempty"` -} - -// ComponentPurgeStatusResponse response containing status for a specific purge operation. -type ComponentPurgeStatusResponse struct { - autorest.Response `json:"-"` - // Status - Status of the operation represented by the requested Id. Possible values include: 'PurgeStatePending', 'PurgeStateCompleted' - Status PurgeState `json:"status,omitempty"` -} - -// ComponentsResource an azure resource object -type ComponentsResource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for ComponentsResource. -func (cr ComponentsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cr.Location != nil { - objectMap["location"] = cr.Location - } - if cr.Tags != nil { - objectMap["tags"] = cr.Tags - } - return json.Marshal(objectMap) -} - -// ErrorFieldContract error Field contract. -type ErrorFieldContract struct { - // Code - Property level error code. - Code *string `json:"code,omitempty"` - // Message - Human-readable representation of property-level error. - Message *string `json:"message,omitempty"` - // Target - Property name. - Target *string `json:"target,omitempty"` -} - -// ErrorResponse error response indicates Insights service is not able to process the incoming request. The -// reason is provided in the error message. -type ErrorResponse struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// ErrorResponseComponents ... -type ErrorResponseComponents struct { - // Error - Error response indicates Insights service is not able to process the incoming request. The reason is provided in the error message. - Error *ErrorResponseComponentsError `json:"error,omitempty"` -} - -// ErrorResponseComponentsError error response indicates Insights service is not able to process the -// incoming request. The reason is provided in the error message. -type ErrorResponseComponentsError struct { - // Code - READ-ONLY; Error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseComponentsError. -func (erc ErrorResponseComponentsError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ErrorResponseLinkedStorage ... -type ErrorResponseLinkedStorage struct { - // Error - Error response indicates Insights service is not able to process the incoming request. The reason is provided in the error message. - Error *ErrorResponseLinkedStorageError `json:"error,omitempty"` -} - -// ErrorResponseLinkedStorageError error response indicates Insights service is not able to process the -// incoming request. The reason is provided in the error message. -type ErrorResponseLinkedStorageError struct { - // Code - READ-ONLY; Error code. - Code *string `json:"code,omitempty"` - // Message - READ-ONLY; Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// MarshalJSON is the custom marshaler for ErrorResponseLinkedStorageError. -func (erls ErrorResponseLinkedStorageError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// InnerError inner error -type InnerError struct { - // Diagnosticcontext - Provides correlation for request - Diagnosticcontext *string `json:"diagnosticcontext,omitempty"` - // Time - Request time - Time *date.Time `json:"time,omitempty"` -} - -// LinkedStorageAccountsProperties an Application Insights component linked storage account -type LinkedStorageAccountsProperties struct { - // LinkedStorageAccount - Linked storage account resource ID - LinkedStorageAccount *string `json:"linkedStorageAccount,omitempty"` -} - -// LinkProperties contains a sourceId and workbook resource id to link two resources. -type LinkProperties struct { - // SourceID - The source Azure resource id - SourceID *string `json:"sourceId,omitempty"` - // TargetID - The workbook Azure resource id - TargetID *string `json:"targetId,omitempty"` - // Category - The category of workbook - Category *string `json:"category,omitempty"` -} - -// ListAnnotation ... -type ListAnnotation struct { - autorest.Response `json:"-"` - Value *[]Annotation `json:"value,omitempty"` -} - -// ListApplicationInsightsComponentAnalyticsItem ... -type ListApplicationInsightsComponentAnalyticsItem struct { - autorest.Response `json:"-"` - Value *[]ApplicationInsightsComponentAnalyticsItem `json:"value,omitempty"` -} - -// ListApplicationInsightsComponentExportConfiguration ... -type ListApplicationInsightsComponentExportConfiguration struct { - autorest.Response `json:"-"` - Value *[]ApplicationInsightsComponentExportConfiguration `json:"value,omitempty"` -} - -// ListApplicationInsightsComponentFavorite ... -type ListApplicationInsightsComponentFavorite struct { - autorest.Response `json:"-"` - Value *[]ApplicationInsightsComponentFavorite `json:"value,omitempty"` -} - -// ListApplicationInsightsComponentProactiveDetectionConfiguration ... -type ListApplicationInsightsComponentProactiveDetectionConfiguration struct { - autorest.Response `json:"-"` - Value *[]ApplicationInsightsComponentProactiveDetectionConfiguration `json:"value,omitempty"` -} - -// MyWorkbook an Application Insights private workbook definition. -type MyWorkbook struct { - autorest.Response `json:"-"` - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' - Kind SharedTypeKind `json:"kind,omitempty"` - // MyWorkbookProperties - Metadata describing a workbook for an Azure resource. - *MyWorkbookProperties `json:"properties,omitempty"` - // ID - Azure resource Id - ID *string `json:"id,omitempty"` - // Name - Azure resource name - Name *string `json:"name,omitempty"` - // Type - Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MyWorkbook. -func (mw MyWorkbook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mw.Kind != "" { - objectMap["kind"] = mw.Kind - } - if mw.MyWorkbookProperties != nil { - objectMap["properties"] = mw.MyWorkbookProperties - } - if mw.ID != nil { - objectMap["id"] = mw.ID - } - if mw.Name != nil { - objectMap["name"] = mw.Name - } - if mw.Type != nil { - objectMap["type"] = mw.Type - } - if mw.Location != nil { - objectMap["location"] = mw.Location - } - if mw.Tags != nil { - objectMap["tags"] = mw.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MyWorkbook struct. -func (mw *MyWorkbook) 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 "kind": - if v != nil { - var kind SharedTypeKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - mw.Kind = kind - } - case "properties": - if v != nil { - var myWorkbookProperties MyWorkbookProperties - err = json.Unmarshal(*v, &myWorkbookProperties) - if err != nil { - return err - } - mw.MyWorkbookProperties = &myWorkbookProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mw.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - mw.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - mw.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mw.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mw.Tags = tags - } - } - } - - return nil -} - -// MyWorkbookError error message body that will indicate why the operation failed. -type MyWorkbookError struct { - // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. - Code *string `json:"code,omitempty"` - // Message - Human-readable representation of the error. - Message *string `json:"message,omitempty"` - // Details - The list of invalid fields send in request, in case of validation error. - Details *[]ErrorFieldContract `json:"details,omitempty"` -} - -// MyWorkbookProperties properties that contain a private workbook. -type MyWorkbookProperties struct { - // DisplayName - The user-defined name of the private workbook. - DisplayName *string `json:"displayName,omitempty"` - // SerializedData - Configuration of this particular private workbook. Configuration data is a string containing valid JSON - SerializedData *string `json:"serializedData,omitempty"` - // Version - This instance's version of the data model. This can change as new features are added that can be marked private workbook. - Version *string `json:"version,omitempty"` - // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this private workbook definition. - TimeModified *string `json:"timeModified,omitempty"` - // Category - Workbook category, as defined by the user at creation time. - Category *string `json:"category,omitempty"` - // Tags - A list of 0 or more tags that are associated with this private workbook definition - Tags *[]string `json:"tags,omitempty"` - // UserID - READ-ONLY; Unique user id of the specific user that owns this private workbook. - UserID *string `json:"userId,omitempty"` - // SourceID - Optional resourceId for a source resource. - SourceID *string `json:"sourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for MyWorkbookProperties. -func (mwp MyWorkbookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mwp.DisplayName != nil { - objectMap["displayName"] = mwp.DisplayName - } - if mwp.SerializedData != nil { - objectMap["serializedData"] = mwp.SerializedData - } - if mwp.Version != nil { - objectMap["version"] = mwp.Version - } - if mwp.Category != nil { - objectMap["category"] = mwp.Category - } - if mwp.Tags != nil { - objectMap["tags"] = mwp.Tags - } - if mwp.SourceID != nil { - objectMap["sourceId"] = mwp.SourceID - } - return json.Marshal(objectMap) -} - -// MyWorkbookResource an azure resource object -type MyWorkbookResource struct { - // ID - Azure resource Id - ID *string `json:"id,omitempty"` - // Name - Azure resource name - Name *string `json:"name,omitempty"` - // Type - Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for MyWorkbookResource. -func (mwr MyWorkbookResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mwr.ID != nil { - objectMap["id"] = mwr.ID - } - if mwr.Name != nil { - objectMap["name"] = mwr.Name - } - if mwr.Type != nil { - objectMap["type"] = mwr.Type - } - if mwr.Location != nil { - objectMap["location"] = mwr.Location - } - if mwr.Tags != nil { - objectMap["tags"] = mwr.Tags - } - return json.Marshal(objectMap) -} - -// MyWorkbooksListResult workbook list result. -type MyWorkbooksListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; An array of private workbooks. - Value *[]MyWorkbook `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for MyWorkbooksListResult. -func (mwlr MyWorkbooksListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Operation CDN REST API operation -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - The object that represents the operation. - Display *OperationDisplay `json:"display,omitempty"` -} - -// OperationDisplay the object that represents the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.Cdn - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Profile, endpoint, etc. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` -} - -// OperationListResult result of the request to list CDN operations. It contains a list of operations and a -// URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of CDN operations supported by the CDN resource provider. - Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. - NextLink *string `json:"nextLink,omitempty"` -} - -// OperationListResultIterator provides access to a complete listing of Operation values. -type OperationListResultIterator struct { - i int - page OperationListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *OperationListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter OperationListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter OperationListResultIterator) Response() OperationListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter OperationListResultIterator) Value() Operation { - if !iter.page.NotDone() { - return Operation{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the OperationListResultIterator type. -func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { - return OperationListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (olr OperationListResult) IsEmpty() bool { - return olr.Value == nil || len(*olr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (olr OperationListResult) hasNextLink() bool { - return olr.NextLink != nil && len(*olr.NextLink) != 0 -} - -// operationListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { - if !olr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(olr.NextLink))) -} - -// OperationListResultPage contains a page of Operation values. -type OperationListResultPage struct { - fn func(context.Context, OperationListResult) (OperationListResult, error) - olr OperationListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.olr) - if err != nil { - return err - } - page.olr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *OperationListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page OperationListResultPage) NotDone() bool { - return !page.olr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page OperationListResultPage) Response() OperationListResult { - return page.olr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page OperationListResultPage) Values() []Operation { - if page.olr.IsEmpty() { - return nil - } - return *page.olr.Value -} - -// Creates a new instance of the OperationListResultPage type. -func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { - return OperationListResultPage{ - fn: getNextPage, - olr: cur, - } -} - -// PrivateLinkScopedResource the private link scope resource reference. -type PrivateLinkScopedResource struct { - // ResourceID - The full resource Id of the private link scope resource. - ResourceID *string `json:"ResourceId,omitempty"` - // ScopeID - The private link scope unique Identifier. - ScopeID *string `json:"ScopeId,omitempty"` -} - -// 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"` - // 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 ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource 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"` - // 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 Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// TagsResource a container holding only the Tags for a resource, allowing the user to update the tags on a -// WebTest instance. -type TagsResource struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for TagsResource. -func (tr TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - return json.Marshal(objectMap) -} - -// 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"` - // Location - The geo-location where the resource lives - Location *string `json:"location,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 TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// WebTest an Application Insights web test definition. -type WebTest struct { - autorest.Response `json:"-"` - // Kind - The kind of web test that this web test watches. Choices are ping and multistep. Possible values include: 'WebTestKindPing', 'WebTestKindMultistep' - Kind WebTestKind `json:"kind,omitempty"` - // WebTestProperties - Metadata describing a web test for an Azure resource. - *WebTestProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for WebTest. -func (wt WebTest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wt.Kind != "" { - objectMap["kind"] = wt.Kind - } - if wt.WebTestProperties != nil { - objectMap["properties"] = wt.WebTestProperties - } - if wt.Location != nil { - objectMap["location"] = wt.Location - } - if wt.Tags != nil { - objectMap["tags"] = wt.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for WebTest struct. -func (wt *WebTest) 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 "kind": - if v != nil { - var kind WebTestKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - wt.Kind = kind - } - case "properties": - if v != nil { - var webTestProperties WebTestProperties - err = json.Unmarshal(*v, &webTestProperties) - if err != nil { - return err - } - wt.WebTestProperties = &webTestProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - wt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - wt.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - wt.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - wt.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - wt.Tags = tags - } - } - } - - return nil -} - -// WebTestGeolocation geo-physical location to run a web test from. You must specify one or more locations -// for the test to run from. -type WebTestGeolocation struct { - // Location - Location ID for the webtest to run from. - Location *string `json:"Id,omitempty"` -} - -// WebTestListResult a list of 0 or more Application Insights web test definitions. -type WebTestListResult struct { - autorest.Response `json:"-"` - // Value - Set of Application Insights web test definitions. - Value *[]WebTest `json:"value,omitempty"` - // NextLink - The link to get the next part of the returned list of web tests, should the return set be too large for a single request. May be null. - NextLink *string `json:"nextLink,omitempty"` -} - -// WebTestListResultIterator provides access to a complete listing of WebTest values. -type WebTestListResultIterator struct { - i int - page WebTestListResultPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *WebTestListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestListResultIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *WebTestListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter WebTestListResultIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter WebTestListResultIterator) Response() WebTestListResult { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter WebTestListResultIterator) Value() WebTest { - if !iter.page.NotDone() { - return WebTest{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the WebTestListResultIterator type. -func NewWebTestListResultIterator(page WebTestListResultPage) WebTestListResultIterator { - return WebTestListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (wtlr WebTestListResult) IsEmpty() bool { - return wtlr.Value == nil || len(*wtlr.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (wtlr WebTestListResult) hasNextLink() bool { - return wtlr.NextLink != nil && len(*wtlr.NextLink) != 0 -} - -// webTestListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (wtlr WebTestListResult) webTestListResultPreparer(ctx context.Context) (*http.Request, error) { - if !wtlr.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(wtlr.NextLink))) -} - -// WebTestListResultPage contains a page of WebTest values. -type WebTestListResultPage struct { - fn func(context.Context, WebTestListResult) (WebTestListResult, error) - wtlr WebTestListResult -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *WebTestListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestListResultPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.wtlr) - if err != nil { - return err - } - page.wtlr = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *WebTestListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page WebTestListResultPage) NotDone() bool { - return !page.wtlr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page WebTestListResultPage) Response() WebTestListResult { - return page.wtlr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page WebTestListResultPage) Values() []WebTest { - if page.wtlr.IsEmpty() { - return nil - } - return *page.wtlr.Value -} - -// Creates a new instance of the WebTestListResultPage type. -func NewWebTestListResultPage(cur WebTestListResult, getNextPage func(context.Context, WebTestListResult) (WebTestListResult, error)) WebTestListResultPage { - return WebTestListResultPage{ - fn: getNextPage, - wtlr: cur, - } -} - -// WebTestProperties metadata describing a web test for an Azure resource. -type WebTestProperties struct { - // SyntheticMonitorID - Unique ID of this WebTest. This is typically the same value as the Name field. - SyntheticMonitorID *string `json:"SyntheticMonitorId,omitempty"` - // WebTestName - User defined name if this WebTest. - WebTestName *string `json:"Name,omitempty"` - // Description - Purpose/user defined descriptive test for this WebTest. - Description *string `json:"Description,omitempty"` - // Enabled - Is the test actively being monitored. - Enabled *bool `json:"Enabled,omitempty"` - // Frequency - Interval in seconds between test runs for this WebTest. Default value is 300. - Frequency *int32 `json:"Frequency,omitempty"` - // Timeout - Seconds until this WebTest will timeout and fail. Default value is 30. - Timeout *int32 `json:"Timeout,omitempty"` - // WebTestKind - The kind of web test this is, valid choices are ping and multistep. Possible values include: 'WebTestKindPing', 'WebTestKindMultistep' - WebTestKind WebTestKind `json:"Kind,omitempty"` - // RetryEnabled - Allow for retries should this WebTest fail. - RetryEnabled *bool `json:"RetryEnabled,omitempty"` - // Locations - A list of where to physically run the tests from to give global coverage for accessibility of your application. - Locations *[]WebTestGeolocation `json:"Locations,omitempty"` - // Configuration - An XML configuration specification for a WebTest. - Configuration *WebTestPropertiesConfiguration `json:"Configuration,omitempty"` - // ProvisioningState - READ-ONLY; Current state of this component, whether or not is has been provisioned within the resource group it is defined. Users cannot change this value but are able to read from it. Values will include Succeeded, Deploying, Canceled, and Failed. - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for WebTestProperties. -func (wtp WebTestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wtp.SyntheticMonitorID != nil { - objectMap["SyntheticMonitorId"] = wtp.SyntheticMonitorID - } - if wtp.WebTestName != nil { - objectMap["Name"] = wtp.WebTestName - } - if wtp.Description != nil { - objectMap["Description"] = wtp.Description - } - if wtp.Enabled != nil { - objectMap["Enabled"] = wtp.Enabled - } - if wtp.Frequency != nil { - objectMap["Frequency"] = wtp.Frequency - } - if wtp.Timeout != nil { - objectMap["Timeout"] = wtp.Timeout - } - if wtp.WebTestKind != "" { - objectMap["Kind"] = wtp.WebTestKind - } - if wtp.RetryEnabled != nil { - objectMap["RetryEnabled"] = wtp.RetryEnabled - } - if wtp.Locations != nil { - objectMap["Locations"] = wtp.Locations - } - if wtp.Configuration != nil { - objectMap["Configuration"] = wtp.Configuration - } - return json.Marshal(objectMap) -} - -// WebTestPropertiesConfiguration an XML configuration specification for a WebTest. -type WebTestPropertiesConfiguration struct { - // WebTest - The XML specification of a WebTest to run against an application. - WebTest *string `json:"WebTest,omitempty"` -} - -// WebtestsResource an azure resource object -type WebtestsResource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for WebtestsResource. -func (wr WebtestsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wr.Location != nil { - objectMap["location"] = wr.Location - } - if wr.Tags != nil { - objectMap["tags"] = wr.Tags - } - return json.Marshal(objectMap) -} - -// Workbook an Application Insights workbook definition. -type Workbook struct { - autorest.Response `json:"-"` - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' - Kind SharedTypeKind `json:"kind,omitempty"` - // WorkbookProperties - Metadata describing a web test for an Azure resource. - *WorkbookProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Workbook. -func (w Workbook) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if w.Kind != "" { - objectMap["kind"] = w.Kind - } - if w.WorkbookProperties != nil { - objectMap["properties"] = w.WorkbookProperties - } - if w.Location != nil { - objectMap["location"] = w.Location - } - if w.Tags != nil { - objectMap["tags"] = w.Tags - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Workbook struct. -func (w *Workbook) 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 "kind": - if v != nil { - var kind SharedTypeKind - err = json.Unmarshal(*v, &kind) - if err != nil { - return err - } - w.Kind = kind - } - case "properties": - if v != nil { - var workbookProperties WorkbookProperties - err = json.Unmarshal(*v, &workbookProperties) - if err != nil { - return err - } - w.WorkbookProperties = &workbookProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - w.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - w.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - w.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - w.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - w.Tags = tags - } - } - } - - return nil -} - -// WorkbookError error message body that will indicate why the operation failed. -type WorkbookError struct { - // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. - Code *string `json:"code,omitempty"` - // Message - Human-readable representation of the error. - Message *string `json:"message,omitempty"` - // Details - The list of invalid fields send in request, in case of validation error. - Details *[]ErrorFieldContract `json:"details,omitempty"` -} - -// WorkbookProperties properties that contain a workbook. -type WorkbookProperties struct { - // Name - The user-defined name of the workbook. - Name *string `json:"name,omitempty"` - // SerializedData - Configuration of this particular workbook. Configuration data is a string containing valid JSON - SerializedData *string `json:"serializedData,omitempty"` - // Version - This instance's version of the data model. This can change as new features are added that can be marked workbook. - Version *string `json:"version,omitempty"` - // WorkbookID - Internally assigned unique id of the workbook definition. - WorkbookID *string `json:"workbookId,omitempty"` - // SharedTypeKind - Enum indicating if this workbook definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' - SharedTypeKind SharedTypeKind `json:"kind,omitempty"` - // TimeModified - READ-ONLY; Date and time in UTC of the last modification that was made to this workbook definition. - TimeModified *string `json:"timeModified,omitempty"` - // Category - Workbook category, as defined by the user at creation time. - Category *string `json:"category,omitempty"` - // Tags - A list of 0 or more tags that are associated with this workbook definition - Tags *[]string `json:"tags,omitempty"` - // UserID - Unique user id of the specific user that owns this workbook. - UserID *string `json:"userId,omitempty"` - // SourceResourceID - Optional resourceId for a source resource. - SourceResourceID *string `json:"sourceResourceId,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkbookProperties. -func (wp WorkbookProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wp.Name != nil { - objectMap["name"] = wp.Name - } - if wp.SerializedData != nil { - objectMap["serializedData"] = wp.SerializedData - } - if wp.Version != nil { - objectMap["version"] = wp.Version - } - if wp.WorkbookID != nil { - objectMap["workbookId"] = wp.WorkbookID - } - if wp.SharedTypeKind != "" { - objectMap["kind"] = wp.SharedTypeKind - } - if wp.Category != nil { - objectMap["category"] = wp.Category - } - if wp.Tags != nil { - objectMap["tags"] = wp.Tags - } - if wp.UserID != nil { - objectMap["userId"] = wp.UserID - } - if wp.SourceResourceID != nil { - objectMap["sourceResourceId"] = wp.SourceResourceID - } - return json.Marshal(objectMap) -} - -// WorkbookResource an azure resource object -type WorkbookResource struct { - // ID - READ-ONLY; Azure resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Azure resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Azure resource type - Type *string `json:"type,omitempty"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for WorkbookResource. -func (wr WorkbookResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wr.Location != nil { - objectMap["location"] = wr.Location - } - if wr.Tags != nil { - objectMap["tags"] = wr.Tags - } - return json.Marshal(objectMap) -} - -// WorkbooksListResult workbook list result. -type WorkbooksListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; An array of workbooks. - Value *[]Workbook `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkbooksListResult. -func (wlr WorkbooksListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkItemConfiguration work item configuration associated with an application insights resource. -type WorkItemConfiguration struct { - autorest.Response `json:"-"` - // ConnectorID - Connector identifier where work item is created - ConnectorID *string `json:"ConnectorId,omitempty"` - // ConfigDisplayName - Configuration friendly name - ConfigDisplayName *string `json:"ConfigDisplayName,omitempty"` - // IsDefault - Boolean value indicating whether configuration is default - IsDefault *bool `json:"IsDefault,omitempty"` - // ID - Unique Id for work item - ID *string `json:"Id,omitempty"` - // ConfigProperties - Serialized JSON object for detailed properties - ConfigProperties *string `json:"ConfigProperties,omitempty"` -} - -// WorkItemConfigurationError error associated with trying to get work item configuration or configurations -type WorkItemConfigurationError struct { - // Code - Error detail code and explanation - Code *string `json:"code,omitempty"` - // Message - Error message - Message *string `json:"message,omitempty"` - Innererror *InnerError `json:"innererror,omitempty"` -} - -// WorkItemConfigurationsListResult work item configuration list result. -type WorkItemConfigurationsListResult struct { - autorest.Response `json:"-"` - // Value - READ-ONLY; An array of work item configurations. - Value *[]WorkItemConfiguration `json:"value,omitempty"` -} - -// MarshalJSON is the custom marshaler for WorkItemConfigurationsListResult. -func (wiclr WorkItemConfigurationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// WorkItemCreateConfiguration work item configuration creation payload -type WorkItemCreateConfiguration struct { - // ConnectorID - Unique connector id - ConnectorID *string `json:"ConnectorId,omitempty"` - // ConnectorDataConfiguration - Serialized JSON object for detailed properties - ConnectorDataConfiguration *string `json:"ConnectorDataConfiguration,omitempty"` - // ValidateOnly - Boolean indicating validate only - ValidateOnly *bool `json:"ValidateOnly,omitempty"` - // WorkItemProperties - Custom work item properties - WorkItemProperties map[string]*string `json:"WorkItemProperties"` -} - -// MarshalJSON is the custom marshaler for WorkItemCreateConfiguration. -func (wicc WorkItemCreateConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if wicc.ConnectorID != nil { - objectMap["ConnectorId"] = wicc.ConnectorID - } - if wicc.ConnectorDataConfiguration != nil { - objectMap["ConnectorDataConfiguration"] = wicc.ConnectorDataConfiguration - } - if wicc.ValidateOnly != nil { - objectMap["ValidateOnly"] = wicc.ValidateOnly - } - if wicc.WorkItemProperties != nil { - objectMap["WorkItemProperties"] = wicc.WorkItemProperties - } - return json.Marshal(objectMap) -} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/myworkbooks.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/myworkbooks.go deleted file mode 100644 index 0f11b643e8bc..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/myworkbooks.go +++ /dev/null @@ -1,566 +0,0 @@ -package insights - -// 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" -) - -// MyWorkbooksClient is the composite Swagger for Application Insights Management Client -type MyWorkbooksClient struct { - BaseClient -} - -// NewMyWorkbooksClient creates an instance of the MyWorkbooksClient client. -func NewMyWorkbooksClient(subscriptionID string) MyWorkbooksClient { - return NewMyWorkbooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewMyWorkbooksClientWithBaseURI creates an instance of the MyWorkbooksClient 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 NewMyWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) MyWorkbooksClient { - return MyWorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new private workbook. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workbookProperties - properties that need to be specified to create a new private workbook. -func (client MyWorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (result MyWorkbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.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}}}, - {TargetValue: workbookProperties, - Constraints: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "workbookProperties.MyWorkbookProperties.DisplayName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.MyWorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.MyWorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.MyWorkbooksClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client MyWorkbooksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), - autorest.WithJSON(workbookProperties), - 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 MyWorkbooksClient) 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 MyWorkbooksClient) CreateOrUpdateResponder(resp *http.Response) (result MyWorkbook, 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 private workbook. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client MyWorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.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("insights.MyWorkbooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client MyWorkbooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", 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 MyWorkbooksClient) 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 MyWorkbooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a single private workbook by its resourceName. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client MyWorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result MyWorkbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.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("insights.MyWorkbooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client MyWorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", 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 MyWorkbooksClient) 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 MyWorkbooksClient) GetResponder(resp *http.Response) (result MyWorkbook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get all private workbooks defined within a specified resource group and category. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// category - category of workbook to return. -// tags - tags presents on each workbook returned. -// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If -// false, only return summary content for workbooks. -func (client MyWorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (result MyWorkbooksListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.ListByResourceGroup") - 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("insights.MyWorkbooksClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, category, tags, canFetchContent) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client MyWorkbooksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "category": autorest.Encode("query", category), - } - if tags != nil && len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags, ",") - } - if canFetchContent != nil { - queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client MyWorkbooksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client MyWorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result MyWorkbooksListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListBySubscription get all private workbooks defined within a specified subscription and category. -// Parameters: -// category - category of workbook to return. -// tags - tags presents on each workbook returned. -// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If -// false, only return summary content for workbooks. -func (client MyWorkbooksClient) ListBySubscription(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (result MyWorkbooksListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.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("insights.MyWorkbooksClient", "ListBySubscription", err.Error()) - } - - req, err := client.ListBySubscriptionPreparer(ctx, category, tags, canFetchContent) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "ListBySubscription", resp, "Failure responding to request") - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client MyWorkbooksClient) ListBySubscriptionPreparer(ctx context.Context, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "category": autorest.Encode("query", category), - } - if tags != nil && len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags, ",") - } - if canFetchContent != nil { - queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/myWorkbooks", 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 MyWorkbooksClient) 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 MyWorkbooksClient) ListBySubscriptionResponder(resp *http.Response) (result MyWorkbooksListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a private workbook that has already been added. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workbookProperties - properties that need to be specified to create a new private workbook. -func (client MyWorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (result MyWorkbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/MyWorkbooksClient.Update") - 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("insights.MyWorkbooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.MyWorkbooksClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client MyWorkbooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties MyWorkbook) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/myWorkbooks/{resourceName}", pathParameters), - autorest.WithJSON(workbookProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client MyWorkbooksClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client MyWorkbooksClient) UpdateResponder(resp *http.Response) (result MyWorkbook, 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/appinsights/mgmt/2020-02-02-preview/insights/proactivedetectionconfigurations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/proactivedetectionconfigurations.go deleted file mode 100644 index 78223d23395b..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/proactivedetectionconfigurations.go +++ /dev/null @@ -1,298 +0,0 @@ -package insights - -// 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" -) - -// ProactiveDetectionConfigurationsClient is the composite Swagger for Application Insights Management Client -type ProactiveDetectionConfigurationsClient struct { - BaseClient -} - -// NewProactiveDetectionConfigurationsClient creates an instance of the ProactiveDetectionConfigurationsClient client. -func NewProactiveDetectionConfigurationsClient(subscriptionID string) ProactiveDetectionConfigurationsClient { - return NewProactiveDetectionConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProactiveDetectionConfigurationsClientWithBaseURI creates an instance of the -// ProactiveDetectionConfigurationsClient 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 NewProactiveDetectionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ProactiveDetectionConfigurationsClient { - return ProactiveDetectionConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the ProactiveDetection configuration for this configuration id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// configurationID - the ProactiveDetection configuration ID. This is unique within a Application Insights -// component. -func (client ProactiveDetectionConfigurationsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.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("insights.ProactiveDetectionConfigurationsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, configurationID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProactiveDetectionConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, configurationID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "ConfigurationId": autorest.Encode("path", configurationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", 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 ProactiveDetectionConfigurationsClient) 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 ProactiveDetectionConfigurationsClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets a list of ProactiveDetection configurations of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client ProactiveDetectionConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.List") - 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("insights.ProactiveDetectionConfigurationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ProactiveDetectionConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ProactiveDetectionConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ProactiveDetectionConfigurationsClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentProactiveDetectionConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result.Value), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update update the ProactiveDetection configuration for this configuration id. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// configurationID - the ProactiveDetection configuration ID. This is unique within a Application Insights -// component. -// proactiveDetectionProperties - properties that need to be specified to update the ProactiveDetection -// configuration. -func (client ProactiveDetectionConfigurationsClient) Update(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties ApplicationInsightsComponentProactiveDetectionConfiguration) (result ApplicationInsightsComponentProactiveDetectionConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProactiveDetectionConfigurationsClient.Update") - 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("insights.ProactiveDetectionConfigurationsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, configurationID, proactiveDetectionProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.ProactiveDetectionConfigurationsClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ProactiveDetectionConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, configurationID string, proactiveDetectionProperties ApplicationInsightsComponentProactiveDetectionConfiguration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "ConfigurationId": autorest.Encode("path", configurationID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/ProactiveDetectionConfigs/{ConfigurationId}", pathParameters), - autorest.WithJSON(proactiveDetectionProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client ProactiveDetectionConfigurationsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client ProactiveDetectionConfigurationsClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentProactiveDetectionConfiguration, 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/appinsights/mgmt/2020-02-02-preview/insights/webtestlocations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtestlocations.go deleted file mode 100644 index dcb3923ba146..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtestlocations.go +++ /dev/null @@ -1,118 +0,0 @@ -package insights - -// 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" -) - -// WebTestLocationsClient is the composite Swagger for Application Insights Management Client -type WebTestLocationsClient struct { - BaseClient -} - -// NewWebTestLocationsClient creates an instance of the WebTestLocationsClient client. -func NewWebTestLocationsClient(subscriptionID string) WebTestLocationsClient { - return NewWebTestLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebTestLocationsClientWithBaseURI creates an instance of the WebTestLocationsClient 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 NewWebTestLocationsClientWithBaseURI(baseURI string, subscriptionID string) WebTestLocationsClient { - return WebTestLocationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List gets a list of web test locations available to this Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client WebTestLocationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result ApplicationInsightsWebTestLocationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestLocationsClient.List") - 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("insights.WebTestLocationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestLocationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebTestLocationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/syntheticmonitorlocations", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestLocationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WebTestLocationsClient) ListResponder(resp *http.Response) (result ApplicationInsightsWebTestLocationsListResult, 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/appinsights/mgmt/2020-02-02-preview/insights/webtests.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtests.go deleted file mode 100644 index cb9450fdee91..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/webtests.go +++ /dev/null @@ -1,755 +0,0 @@ -package insights - -// 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" -) - -// WebTestsClient is the composite Swagger for Application Insights Management Client -type WebTestsClient struct { - BaseClient -} - -// NewWebTestsClient creates an instance of the WebTestsClient client. -func NewWebTestsClient(subscriptionID string) WebTestsClient { - return NewWebTestsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWebTestsClientWithBaseURI creates an instance of the WebTestsClient 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 NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { - return WebTestsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates or updates an Application Insights web test definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// webTestName - the name of the Application Insights webtest resource. -// webTestDefinition - properties that need to be specified to create or update an Application Insights web -// test definition. -func (client WebTestsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest) (result WebTest, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.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: 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}}}, - {TargetValue: webTestDefinition, - Constraints: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "webTestDefinition.WebTestProperties.SyntheticMonitorID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webTestDefinition.WebTestProperties.WebTestName", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "webTestDefinition.WebTestProperties.Locations", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.WebTestsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, webTestName, webTestDefinition) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WebTestsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, webTestName string, webTestDefinition WebTest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), - autorest.WithJSON(webTestDefinition), - 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 WebTestsClient) 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 WebTestsClient) CreateOrUpdateResponder(resp *http.Response) (result WebTest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete deletes an Application Insights web test. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// webTestName - the name of the Application Insights webtest resource. -func (client WebTestsClient) Delete(ctx context.Context, resourceGroupName string, webTestName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.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("insights.WebTestsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, webTestName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WebTestsClient) DeletePreparer(ctx context.Context, resourceGroupName string, webTestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", 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 WebTestsClient) 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 WebTestsClient) 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 a specific Application Insights web test definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// webTestName - the name of the Application Insights webtest resource. -func (client WebTestsClient) Get(ctx context.Context, resourceGroupName string, webTestName string) (result WebTest, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.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("insights.WebTestsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, webTestName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WebTestsClient) GetPreparer(ctx context.Context, resourceGroupName string, webTestName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", 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 WebTestsClient) 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 WebTestsClient) GetResponder(resp *http.Response) (result WebTest, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get all Application Insights web test alerts definitions within a subscription. -func (client WebTestsClient) List(ctx context.Context) (result WebTestListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.List") - defer func() { - sc := -1 - if result.wtlr.Response.Response != nil { - sc = result.wtlr.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("insights.WebTestsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.wtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", resp, "Failure sending request") - return - } - - result.wtlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "List", resp, "Failure responding to request") - return - } - if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WebTestsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WebTestsClient) ListResponder(resp *http.Response) (result WebTestListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client WebTestsClient) listNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { - req, err := lastResults.webTestListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebTestsClient) ListComplete(ctx context.Context) (result WebTestListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx) - return -} - -// ListByComponent get all Application Insights web tests defined for the specified component. -// Parameters: -// componentName - the name of the Application Insights component resource. -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client WebTestsClient) ListByComponent(ctx context.Context, componentName string, resourceGroupName string) (result WebTestListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByComponent") - defer func() { - sc := -1 - if result.wtlr.Response.Response != nil { - sc = result.wtlr.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("insights.WebTestsClient", "ListByComponent", err.Error()) - } - - result.fn = client.listByComponentNextResults - req, err := client.ListByComponentPreparer(ctx, componentName, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", nil, "Failure preparing request") - return - } - - resp, err := client.ListByComponentSender(req) - if err != nil { - result.wtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", resp, "Failure sending request") - return - } - - result.wtlr, err = client.ListByComponentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByComponent", resp, "Failure responding to request") - return - } - if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByComponentPreparer prepares the ListByComponent request. -func (client WebTestsClient) ListByComponentPreparer(ctx context.Context, componentName string, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "componentName": autorest.Encode("path", componentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{componentName}/webtests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByComponentSender sends the ListByComponent request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) ListByComponentSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByComponentResponder handles the response to the ListByComponent request. The method always -// closes the http.Response Body. -func (client WebTestsClient) ListByComponentResponder(resp *http.Response) (result WebTestListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByComponentNextResults retrieves the next set of results, if any. -func (client WebTestsClient) listByComponentNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { - req, err := lastResults.webTestListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByComponentSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByComponentResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByComponentNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByComponentComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebTestsClient) ListByComponentComplete(ctx context.Context, componentName string, resourceGroupName string) (result WebTestListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByComponent") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByComponent(ctx, componentName, resourceGroupName) - return -} - -// ListByResourceGroup get all Application Insights web tests defined within a specified resource group. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -func (client WebTestsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result WebTestListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.wtlr.Response.Response != nil { - sc = result.wtlr.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("insights.WebTestsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.wtlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.wtlr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - if result.wtlr.hasNextLink() && result.wtlr.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WebTestsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WebTestsClient) ListByResourceGroupResponder(resp *http.Response) (result WebTestListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByResourceGroupNextResults retrieves the next set of results, if any. -func (client WebTestsClient) listByResourceGroupNextResults(ctx context.Context, lastResults WebTestListResult) (result WebTestListResult, err error) { - req, err := lastResults.webTestListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client WebTestsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result WebTestListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) - return -} - -// UpdateTags creates or updates an Application Insights web test definition. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// webTestName - the name of the Application Insights webtest resource. -// webTestTags - updated tag information to set into the web test instance. -func (client WebTestsClient) UpdateTags(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource) (result WebTest, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WebTestsClient.UpdateTags") - 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("insights.WebTestsClient", "UpdateTags", err.Error()) - } - - req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, webTestName, webTestTags) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateTagsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", resp, "Failure sending request") - return - } - - result, err = client.UpdateTagsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WebTestsClient", "UpdateTags", resp, "Failure responding to request") - return - } - - return -} - -// UpdateTagsPreparer prepares the UpdateTags request. -func (client WebTestsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, webTestName string, webTestTags TagsResource) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "webTestName": autorest.Encode("path", webTestName), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests/{webTestName}", pathParameters), - autorest.WithJSON(webTestTags), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateTagsSender sends the UpdateTags request. The method will close the -// http.Response Body if it receives an error. -func (client WebTestsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateTagsResponder handles the response to the UpdateTags request. The method always -// closes the http.Response Body. -func (client WebTestsClient) UpdateTagsResponder(resp *http.Response) (result WebTest, 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/appinsights/mgmt/2020-02-02-preview/insights/workbooks.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workbooks.go deleted file mode 100644 index e30bd2ce8bb4..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workbooks.go +++ /dev/null @@ -1,479 +0,0 @@ -package insights - -// 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" -) - -// WorkbooksClient is the composite Swagger for Application Insights Management Client -type WorkbooksClient struct { - BaseClient -} - -// NewWorkbooksClient creates an instance of the WorkbooksClient client. -func NewWorkbooksClient(subscriptionID string) WorkbooksClient { - return NewWorkbooksClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkbooksClientWithBaseURI creates an instance of the WorkbooksClient 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 NewWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) WorkbooksClient { - return WorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create a new workbook. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workbookProperties - properties that need to be specified to create a new workbook. -func (client WorkbooksClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.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}}}, - {TargetValue: workbookProperties, - Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.WorkbookID", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "workbookProperties.WorkbookProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, - }}}}}); err != nil { - return result, validation.NewError("insights.WorkbooksClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client WorkbooksClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), - autorest.WithJSON(workbookProperties), - 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 WorkbooksClient) 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 WorkbooksClient) CreateOrUpdateResponder(resp *http.Response) (result Workbook, 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 workbook. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client WorkbooksClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.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("insights.WorkbooksClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkbooksClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbooksClient) 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 WorkbooksClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a single workbook by its resourceName. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Workbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.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("insights.WorkbooksClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbooksClient) 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 WorkbooksClient) GetResponder(resp *http.Response) (result Workbook, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup get all Workbooks defined within a specified resource group and category. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// category - category of workbook to return. -// tags - tags presents on each workbook returned. -// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If -// false, only return summary content for workbooks. -func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (result WorkbooksListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.ListByResourceGroup") - 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("insights.WorkbooksClient", "ListByResourceGroup", err.Error()) - } - - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, category, tags, canFetchContent) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure responding to request") - return - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client WorkbooksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "category": autorest.Encode("query", category), - } - if tags != nil && len(tags) > 0 { - queryParameters["tags"] = autorest.Encode("query", tags, ",") - } - if canFetchContent != nil { - queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the -// http.Response Body if it receives an error. -func (client WorkbooksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always -// closes the http.Response Body. -func (client WorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result WorkbooksListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update updates a workbook that has already been added. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workbookProperties - properties that need to be specified to create a new workbook. -func (client WorkbooksClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Update") - 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("insights.WorkbooksClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Update", resp, "Failure responding to request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client WorkbooksClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), - autorest.WithJSON(workbookProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client WorkbooksClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client WorkbooksClient) UpdateResponder(resp *http.Response) (result Workbook, 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/appinsights/mgmt/2020-02-02-preview/insights/workitemconfigurations.go b/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workitemconfigurations.go deleted file mode 100644 index c46789bddc6e..000000000000 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/workitemconfigurations.go +++ /dev/null @@ -1,559 +0,0 @@ -package insights - -// 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" -) - -// WorkItemConfigurationsClient is the composite Swagger for Application Insights Management Client -type WorkItemConfigurationsClient struct { - BaseClient -} - -// NewWorkItemConfigurationsClient creates an instance of the WorkItemConfigurationsClient client. -func NewWorkItemConfigurationsClient(subscriptionID string) WorkItemConfigurationsClient { - return NewWorkItemConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWorkItemConfigurationsClientWithBaseURI creates an instance of the WorkItemConfigurationsClient 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 NewWorkItemConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) WorkItemConfigurationsClient { - return WorkItemConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a work item configuration for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workItemConfigurationProperties - properties that need to be specified to create a work item configuration -// of a Application Insights component. -func (client WorkItemConfigurationsClient) Create(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties WorkItemCreateConfiguration) (result WorkItemConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.Create") - 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("insights.WorkItemConfigurationsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, workItemConfigurationProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client WorkItemConfigurationsClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigurationProperties WorkItemCreateConfiguration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", pathParameters), - autorest.WithJSON(workItemConfigurationProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client WorkItemConfigurationsClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client WorkItemConfigurationsClient) CreateResponder(resp *http.Response) (result WorkItemConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a work item configuration of an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as -// defined in connector configuration -func (client WorkItemConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.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("insights.WorkItemConfigurationsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, workItemConfigID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client WorkItemConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workItemConfigId": autorest.Encode("path", workItemConfigID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", 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 WorkItemConfigurationsClient) 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 WorkItemConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// GetDefault gets default work item configurations that exist for the application -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client WorkItemConfigurationsClient) GetDefault(ctx context.Context, resourceGroupName string, resourceName string) (result WorkItemConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.GetDefault") - 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("insights.WorkItemConfigurationsClient", "GetDefault", err.Error()) - } - - req, err := client.GetDefaultPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", nil, "Failure preparing request") - return - } - - resp, err := client.GetDefaultSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", resp, "Failure sending request") - return - } - - result, err = client.GetDefaultResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetDefault", resp, "Failure responding to request") - return - } - - return -} - -// GetDefaultPreparer prepares the GetDefault request. -func (client WorkItemConfigurationsClient) GetDefaultPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/DefaultWorkItemConfig", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetDefaultSender sends the GetDefault request. The method will close the -// http.Response Body if it receives an error. -func (client WorkItemConfigurationsClient) GetDefaultSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetDefaultResponder handles the response to the GetDefault request. The method always -// closes the http.Response Body. -func (client WorkItemConfigurationsClient) GetDefaultResponder(resp *http.Response) (result WorkItemConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetItem gets specified work item configuration for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as -// defined in connector configuration -func (client WorkItemConfigurationsClient) GetItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (result WorkItemConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.GetItem") - 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("insights.WorkItemConfigurationsClient", "GetItem", err.Error()) - } - - req, err := client.GetItemPreparer(ctx, resourceGroupName, resourceName, workItemConfigID) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", nil, "Failure preparing request") - return - } - - resp, err := client.GetItemSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", resp, "Failure sending request") - return - } - - result, err = client.GetItemResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "GetItem", resp, "Failure responding to request") - return - } - - return -} - -// GetItemPreparer prepares the GetItem request. -func (client WorkItemConfigurationsClient) GetItemPreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workItemConfigId": autorest.Encode("path", workItemConfigID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetItemSender sends the GetItem request. The method will close the -// http.Response Body if it receives an error. -func (client WorkItemConfigurationsClient) GetItemSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetItemResponder handles the response to the GetItem request. The method always -// closes the http.Response Body. -func (client WorkItemConfigurationsClient) GetItemResponder(resp *http.Response) (result WorkItemConfiguration, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List gets the list work item configurations that exist for the application -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -func (client WorkItemConfigurationsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result WorkItemConfigurationsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.List") - 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("insights.WorkItemConfigurationsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client WorkItemConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client WorkItemConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client WorkItemConfigurationsClient) ListResponder(resp *http.Response) (result WorkItemConfigurationsListResult, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateItem update a work item configuration for an Application Insights component. -// Parameters: -// resourceGroupName - the name of the resource group. The name is case insensitive. -// resourceName - the name of the Application Insights component resource. -// workItemConfigID - the unique work item configuration Id. This can be either friendly name of connector as -// defined in connector configuration -// workItemConfigurationProperties - properties that need to be specified to update a work item configuration -// for this Application Insights component. -func (client WorkItemConfigurationsClient) UpdateItem(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties WorkItemCreateConfiguration) (result WorkItemConfiguration, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/WorkItemConfigurationsClient.UpdateItem") - 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("insights.WorkItemConfigurationsClient", "UpdateItem", err.Error()) - } - - req, err := client.UpdateItemPreparer(ctx, resourceGroupName, resourceName, workItemConfigID, workItemConfigurationProperties) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateItemSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", resp, "Failure sending request") - return - } - - result, err = client.UpdateItemResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "insights.WorkItemConfigurationsClient", "UpdateItem", resp, "Failure responding to request") - return - } - - return -} - -// UpdateItemPreparer prepares the UpdateItem request. -func (client WorkItemConfigurationsClient) UpdateItemPreparer(ctx context.Context, resourceGroupName string, resourceName string, workItemConfigID string, workItemConfigurationProperties WorkItemCreateConfiguration) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "resourceName": autorest.Encode("path", resourceName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "workItemConfigId": autorest.Encode("path", workItemConfigID), - } - - const APIVersion = "2015-05-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/WorkItemConfigs/{workItemConfigId}", pathParameters), - autorest.WithJSON(workItemConfigurationProperties), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateItemSender sends the UpdateItem request. The method will close the -// http.Response Body if it receives an error. -func (client WorkItemConfigurationsClient) UpdateItemSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// UpdateItemResponder handles the response to the UpdateItem request. The method always -// closes the http.Response Body. -func (client WorkItemConfigurationsClient) UpdateItemResponder(resp *http.Response) (result WorkItemConfiguration, 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/appinsights/mgmt/2021-11-01-preview/insights/CHANGELOG.md b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/CHANGELOG.md index 52911e4cc5e4..f83ba8684984 100644 --- a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/CHANGELOG.md +++ b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/CHANGELOG.md @@ -1,2 +1,26 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. ItemType.ItemTypeFolder + +### Signature Changes + +#### Funcs + +1. WorkbooksClient.Get + - Params + - From: context.Context, string, string + - To: context.Context, string, string, *bool +1. WorkbooksClient.GetPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string, string, *bool + +## Additive Changes + +### New Constants + +1. ItemType.ItemTypeNone diff --git a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/_meta.json b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/_meta.json index 3c946ce4a971..3dae16965f4a 100644 --- a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/_meta.json +++ b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "4946dbb5b2893a77ce52d08e2a855056e1acd361", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", "tag": "package-2021-11-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/enums.go b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/enums.go index ce2174347570..8ff1337f5969 100644 --- a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/enums.go +++ b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/enums.go @@ -165,10 +165,10 @@ func PossibleItemScopePathValues() []ItemScopePath { type ItemType string const ( - // ItemTypeFolder ... - ItemTypeFolder ItemType = "folder" // ItemTypeFunction ... ItemTypeFunction ItemType = "function" + // ItemTypeNone ... + ItemTypeNone ItemType = "none" // ItemTypeQuery ... ItemTypeQuery ItemType = "query" // ItemTypeRecent ... @@ -177,7 +177,7 @@ const ( // PossibleItemTypeValues returns an array of possible values for the ItemType const type. func PossibleItemTypeValues() []ItemType { - return []ItemType{ItemTypeFolder, ItemTypeFunction, ItemTypeQuery, ItemTypeRecent} + return []ItemType{ItemTypeFunction, ItemTypeNone, ItemTypeQuery, ItemTypeRecent} } // ItemTypeParameter enumerates the values for item type parameter. diff --git a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/insightsapi/interfaces.go b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/insightsapi/interfaces.go index 5c6623a48f62..fe87e3c2bede 100644 --- a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/insightsapi/interfaces.go +++ b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/insightsapi/interfaces.go @@ -176,7 +176,7 @@ var _ MyWorkbooksClientAPI = (*insights.MyWorkbooksClient)(nil) type WorkbooksClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.Workbook, sourceID string) (result insights.Workbook, err error) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.Workbook, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (result insights.Workbook, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.WorkbooksListResultPage, err error) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.WorkbooksListResultIterator, err error) ListBySubscription(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.WorkbooksListResultPage, err error) diff --git a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/models.go b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/models.go index 854a64a96087..e8e211f847ea 100644 --- a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/models.go +++ b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/models.go @@ -197,7 +197,7 @@ type ApplicationInsightsComponentAnalyticsItem struct { Version *string `json:"Version,omitempty"` // Scope - Enum indicating if this item definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'ItemScopeShared', 'ItemScopeUser' Scope ItemScope `json:"Scope,omitempty"` - // Type - Enum indicating the type of the Analytics item. Possible values include: 'ItemTypeQuery', 'ItemTypeFunction', 'ItemTypeFolder', 'ItemTypeRecent' + // Type - Enum indicating the type of the Analytics item. Possible values include: 'ItemTypeNone', 'ItemTypeQuery', 'ItemTypeRecent', 'ItemTypeFunction' Type ItemType `json:"Type,omitempty"` // TimeCreated - READ-ONLY; Date and time in UTC when this item was created. TimeCreated *string `json:"TimeCreated,omitempty"` @@ -2528,7 +2528,7 @@ type Workbook struct { SystemData *SystemData `json:"systemData,omitempty"` // Identity - Identity used for BYOS Identity *WorkbookResourceIdentity `json:"identity,omitempty"` - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'KindUser', 'KindShared' + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'KindUser', 'KindShared' Kind Kind `json:"kind,omitempty"` // Etag - Resource etag Etag map[string]*string `json:"etag"` @@ -2783,7 +2783,7 @@ type WorkbookPropertiesUpdateParameters struct { type WorkbookResource struct { // Identity - Identity used for BYOS Identity *WorkbookResourceIdentity `json:"identity,omitempty"` - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'KindUser', 'KindShared' + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'KindUser', 'KindShared' Kind Kind `json:"kind,omitempty"` // Etag - Resource etag Etag map[string]*string `json:"etag"` @@ -3283,7 +3283,7 @@ func (wtup *WorkbookTemplateUpdateParameters) UnmarshalJSON(body []byte) error { // WorkbookUpdateParameters the parameters that can be provided when updating workbook properties // properties. type WorkbookUpdateParameters struct { - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' Kind SharedTypeKind `json:"kind,omitempty"` // Tags - Resource tags. Tags map[string]*string `json:"tags"` diff --git a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/workbooks.go b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/workbooks.go index 75caae3295f9..6c3e55d8662e 100644 --- a/services/preview/appinsights/mgmt/2021-11-01-preview/insights/workbooks.go +++ b/services/preview/appinsights/mgmt/2021-11-01-preview/insights/workbooks.go @@ -218,7 +218,9 @@ func (client WorkbooksClient) DeleteResponder(resp *http.Response) (result autor // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the Application Insights component resource. -func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Workbook, err error) { +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (result Workbook, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Get") defer func() { @@ -238,7 +240,7 @@ func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, return result, validation.NewError("insights.WorkbooksClient", "Get", err.Error()) } - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, canFetchContent) if err != nil { err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", nil, "Failure preparing request") return @@ -261,7 +263,7 @@ func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, } // GetPreparer prepares the Get request. -func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { +func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), @@ -272,6 +274,9 @@ func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -439,7 +444,7 @@ func (client WorkbooksClient) ListByResourceGroupComplete(ctx context.Context, r return } -// ListBySubscription get all private workbooks defined within a specified subscription and category. +// ListBySubscription get all Workbooks defined within a specified subscription and category. // Parameters: // category - category of workbook to return. // tags - tags presents on each workbook returned. diff --git a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/CHANGELOG.md b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/CHANGELOG.md index 52911e4cc5e4..c196d8d0df95 100644 --- a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/CHANGELOG.md +++ b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/CHANGELOG.md @@ -1,2 +1,16 @@ -# Change History +# Unreleased +## Breaking Changes + +### Signature Changes + +#### Funcs + +1. WorkbooksClient.Get + - Params + - From: context.Context, string, string + - To: context.Context, string, string, *bool +1. WorkbooksClient.GetPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string, string, *bool diff --git a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/_meta.json b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/_meta.json index 740456a37552..0df826e1f62e 100644 --- a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/_meta.json +++ b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "932e261a870475e1a29115f62def7bb84e4d7b38", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", "tag": "package-2022-01-11", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/insightsapi/interfaces.go b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/insightsapi/interfaces.go index 6254aeb2a513..23ada55f1f94 100644 --- a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/insightsapi/interfaces.go +++ b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/insightsapi/interfaces.go @@ -174,7 +174,7 @@ var _ MyWorkbooksClientAPI = (*insights.MyWorkbooksClient)(nil) type WorkbooksClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties insights.Workbook, sourceID string) (result insights.Workbook, err error) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result autorest.Response, err error) - Get(ctx context.Context, resourceGroupName string, resourceName string) (result insights.Workbook, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (result insights.Workbook, err error) ListByResourceGroup(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.WorkbooksListResultPage, err error) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, category insights.CategoryType, tags []string, sourceID string, canFetchContent *bool) (result insights.WorkbooksListResultIterator, err error) ListBySubscription(ctx context.Context, category insights.CategoryType, tags []string, canFetchContent *bool) (result insights.WorkbooksListResultPage, err error) diff --git a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/models.go b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/models.go index 6a8238185151..3ab5f5eadfdd 100644 --- a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/models.go +++ b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/models.go @@ -2433,7 +2433,7 @@ type Workbook struct { SystemData *SystemData `json:"systemData,omitempty"` // Identity - Identity used for BYOS Identity *WorkbookResourceIdentity `json:"identity,omitempty"` - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'KindUser', 'KindShared' + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'KindUser', 'KindShared' Kind Kind `json:"kind,omitempty"` // Etag - Resource etag Etag map[string]*string `json:"etag"` @@ -2688,7 +2688,7 @@ type WorkbookPropertiesUpdateParameters struct { type WorkbookResource struct { // Identity - Identity used for BYOS Identity *WorkbookResourceIdentity `json:"identity,omitempty"` - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'KindUser', 'KindShared' + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'KindUser', 'KindShared' Kind Kind `json:"kind,omitempty"` // Etag - Resource etag Etag map[string]*string `json:"etag"` @@ -3188,7 +3188,7 @@ func (wtup *WorkbookTemplateUpdateParameters) UnmarshalJSON(body []byte) error { // WorkbookUpdateParameters the parameters that can be provided when updating workbook properties // properties. type WorkbookUpdateParameters struct { - // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + // Kind - The kind of workbook. Only valid value is shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' Kind SharedTypeKind `json:"kind,omitempty"` // Tags - Resource tags. Tags map[string]*string `json:"tags"` diff --git a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/workbooks.go b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/workbooks.go index 75caae3295f9..6c3e55d8662e 100644 --- a/services/preview/appinsights/mgmt/2022-01-11-preview/insights/workbooks.go +++ b/services/preview/appinsights/mgmt/2022-01-11-preview/insights/workbooks.go @@ -218,7 +218,9 @@ func (client WorkbooksClient) DeleteResponder(resp *http.Response) (result autor // Parameters: // resourceGroupName - the name of the resource group. The name is case insensitive. // resourceName - the name of the Application Insights component resource. -func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Workbook, err error) { +// canFetchContent - flag indicating whether or not to return the full content for each applicable workbook. If +// false, only return summary content for workbooks. +func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (result Workbook, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/WorkbooksClient.Get") defer func() { @@ -238,7 +240,7 @@ func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, return result, validation.NewError("insights.WorkbooksClient", "Get", err.Error()) } - req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, canFetchContent) if err != nil { err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "Get", nil, "Failure preparing request") return @@ -261,7 +263,7 @@ func (client WorkbooksClient) Get(ctx context.Context, resourceGroupName string, } // GetPreparer prepares the Get request. -func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { +func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, canFetchContent *bool) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), @@ -272,6 +274,9 @@ func (client WorkbooksClient) GetPreparer(ctx context.Context, resourceGroupName queryParameters := map[string]interface{}{ "api-version": APIVersion, } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } preparer := autorest.CreatePreparer( autorest.AsGet(), @@ -439,7 +444,7 @@ func (client WorkbooksClient) ListByResourceGroupComplete(ctx context.Context, r return } -// ListBySubscription get all private workbooks defined within a specified subscription and category. +// ListBySubscription get all Workbooks defined within a specified subscription and category. // Parameters: // category - category of workbook to return. // tags - tags presents on each workbook returned. diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json index 34196e12a8ab..7db32eae5c9e 100644 --- a/services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json +++ b/services/preview/appinsights/mgmt/2022-02-01-preview/insights/_meta.json @@ -1,5 +1,5 @@ { - "commit": "162460648e39b3cd20ef3d302008add138e90223", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/applicationinsights/resource-manager/readme.md", "tag": "package-2022-02-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/CHANGELOG.md b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/CHANGELOG.md index 52911e4cc5e4..c1b6629a9798 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/CHANGELOG.md +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/CHANGELOG.md @@ -1,2 +1,43 @@ -# Change History +# Unreleased +## Breaking Changes + +### Signature Changes + +#### Funcs + +1. ProviderOperationsMetadataClient.Get + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ProviderOperationsMetadataClient.GetPreparer + - Params + - From: context.Context, string, string, string + - To: context.Context, string, string +1. ProviderOperationsMetadataClient.List + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ProviderOperationsMetadataClient.ListComplete + - Params + - From: context.Context, string, string + - To: context.Context, string +1. ProviderOperationsMetadataClient.ListPreparer + - Params + - From: context.Context, string, string + - To: context.Context, string + +## Additive Changes + +### New Funcs + +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorAdditionalInfo +1. ErrorDetail +1. ErrorResponse diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/_meta.json b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/_meta.json index 217d0a50b069..e9b5afa8a0c5 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/_meta.json +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2017-10-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/authorizationapi/interfaces.go b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/authorizationapi/interfaces.go index 688e939cba46..fc870b5ebf99 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/authorizationapi/interfaces.go +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/authorizationapi/interfaces.go @@ -44,9 +44,9 @@ var _ RoleDefinitionsClientAPI = (*authorization.RoleDefinitionsClient)(nil) // ProviderOperationsMetadataClientAPI contains the set of methods on the ProviderOperationsMetadataClient type. type ProviderOperationsMetadataClientAPI interface { - Get(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (result authorization.ProviderOperationsMetadata, err error) - List(ctx context.Context, APIVersion string, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error) - ListComplete(ctx context.Context, APIVersion string, expand string) (result authorization.ProviderOperationsMetadataListResultIterator, err error) + Get(ctx context.Context, resourceProviderNamespace string, expand string) (result authorization.ProviderOperationsMetadata, err error) + List(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error) + ListComplete(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultIterator, err error) } var _ ProviderOperationsMetadataClientAPI = (*authorization.ProviderOperationsMetadataClient)(nil) diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/classicadministrators.go b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/classicadministrators.go index 655ee7dd6eb9..273a02d510c1 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/classicadministrators.go +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/classicadministrators.go @@ -10,6 +10,7 @@ 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" ) @@ -46,6 +47,12 @@ func (client ClassicAdministratorsClient) List(ctx context.Context) (result Clas 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("authorization.ClassicAdministratorsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/models.go b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/models.go index fdabfbad4a38..c024575c2900 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/models.go +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/models.go @@ -267,6 +267,47 @@ type ClassicAdministratorProperties struct { Role *string `json:"role,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // Permission role definition permissions. type Permission struct { // Actions - Allowed actions. diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/permissions.go b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/permissions.go index a3358cbeb722..6acd393f3a27 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/permissions.go +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/permissions.go @@ -10,6 +10,7 @@ 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" ) @@ -35,7 +36,7 @@ func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) Perm // ListForResource gets all permissions the caller has for a resource. // Parameters: -// resourceGroupName - the name of the resource group containing the resource. The name is case insensitive. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -51,6 +52,15 @@ func (client PermissionsClient) ListForResource(ctx context.Context, resourceGro 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("authorization.PermissionsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) if err != nil { @@ -159,7 +169,7 @@ func (client PermissionsClient) ListForResourceComplete(ctx context.Context, res // ListForResourceGroup gets all permissions the caller has for a resource group. // Parameters: -// resourceGroupName - the name of the resource group to get the permissions for. The name is case insensitive. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") @@ -171,6 +181,15 @@ func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resour 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("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) if err != nil { diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/provideroperationsmetadata.go b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/provideroperationsmetadata.go index ac10ce7754d9..01c464a610e8 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/provideroperationsmetadata.go +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/provideroperationsmetadata.go @@ -37,9 +37,8 @@ func NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscription // Get gets provider operations metadata for the specified resource provider. // Parameters: // resourceProviderNamespace - the namespace of the resource provider. -// APIVersion - the API version to use for the operation. // expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (result ProviderOperationsMetadata, err error) { +func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.Get") defer func() { @@ -50,7 +49,7 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, resourceProviderNamespace, APIVersion, expand) + req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) if err != nil { err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") return @@ -73,11 +72,12 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource } // GetPreparer prepares the Get request. -func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, APIVersion string, expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), } + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -115,9 +115,8 @@ func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) // List gets provider operations metadata for all resource providers. // Parameters: -// APIVersion - the API version to use for this operation. // expand - specifies whether to expand the values. -func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVersion string, expand string) (result ProviderOperationsMetadataListResultPage, err error) { +func (client ProviderOperationsMetadataClient) List(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") defer func() { @@ -129,7 +128,7 @@ func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVers }() } result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, APIVersion, expand) + req, err := client.ListPreparer(ctx, expand) if err != nil { err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") return @@ -156,7 +155,8 @@ func (client ProviderOperationsMetadataClient) List(ctx context.Context, APIVers } // ListPreparer prepares the List request. -func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, APIVersion string, expand string) (*http.Request, error) { +func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, expand string) (*http.Request, error) { + const APIVersion = "2015-07-01" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -214,7 +214,7 @@ func (client ProviderOperationsMetadataClient) listNextResults(ctx context.Conte } // ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, APIVersion string, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { +func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") defer func() { @@ -225,6 +225,6 @@ func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, tracing.EndSpan(ctx, sc, err) }() } - result.page, err = client.List(ctx, APIVersion, expand) + result.page, err = client.List(ctx, expand) return } diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roleassignments.go b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roleassignments.go index 588272836e55..2ee2aa1d7083 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roleassignments.go +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roleassignments.go @@ -10,6 +10,7 @@ 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" ) @@ -40,7 +41,8 @@ func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. -// roleAssignmentName - the name of the role assignment to create. It can be any valid GUID. +// roleAssignmentName - a GUID for the role assignment to create. The name must be unique and different for +// each role assignment. // parameters - parameters for the role assignment. func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { if tracing.IsEnabled() { @@ -259,7 +261,7 @@ func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -332,7 +334,7 @@ func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.R func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -503,6 +505,12 @@ func (client RoleAssignmentsClient) List(ctx context.Context, filter string) (re 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("authorization.RoleAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -609,7 +617,7 @@ func (client RoleAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets role assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -628,6 +636,15 @@ func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -739,7 +756,7 @@ func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets role assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or // above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope // for the specified principal. @@ -754,6 +771,15 @@ func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roledefinitions.go b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roledefinitions.go index 5bc63943465a..1d17715bff18 100644 --- a/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roledefinitions.go +++ b/services/preview/authorization/mgmt/2017-10-01-preview/authorization/roledefinitions.go @@ -182,7 +182,7 @@ func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md index 52911e4cc5e4..60675616e95a 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/CHANGELOG.md @@ -1,2 +1,16 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorAdditionalInfo +1. ErrorDetail +1. ErrorResponse diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json index 4aa82e054a8c..0ad8d8d72f9f 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2018-01-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go index 71dc9f3cdf7e..adb9c2979f8e 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/classicadministrators.go @@ -10,6 +10,7 @@ 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" ) @@ -43,6 +44,12 @@ func (client ClassicAdministratorsClient) List(ctx context.Context) (result Clas 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("authorization.ClassicAdministratorsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go index 1e1da38902d9..b5ddf57e6d46 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/models.go @@ -267,6 +267,47 @@ type ClassicAdministratorProperties struct { Role *string `json:"role,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // Permission role definition permissions. type Permission struct { // Actions - Allowed actions. diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go index 62d87b8d120b..307f7a567df8 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/permissions.go @@ -10,6 +10,7 @@ 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" ) @@ -32,7 +33,7 @@ func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) Perm // ListForResource gets all permissions the caller has for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -48,6 +49,15 @@ func (client PermissionsClient) ListForResource(ctx context.Context, resourceGro 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("authorization.PermissionsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) if err != nil { @@ -81,7 +91,7 @@ func (client PermissionsClient) ListForResourcePreparer(ctx context.Context, res "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -156,7 +166,7 @@ func (client PermissionsClient) ListForResourceComplete(ctx context.Context, res // ListForResourceGroup gets all permissions the caller has for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") @@ -168,6 +178,15 @@ func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resour 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("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/provideroperationsmetadata.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/provideroperationsmetadata.go index 359c843c0826..77cb8b9768e9 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/provideroperationsmetadata.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/provideroperationsmetadata.go @@ -72,7 +72,7 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource // GetPreparer prepares the Get request. func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, } const APIVersion = "2018-01-01-preview" diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go index bcfa975c050e..7b336b5c0750 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roleassignments.go @@ -38,7 +38,8 @@ func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. -// roleAssignmentName - the name of the role assignment to create. It can be any valid GUID. +// roleAssignmentName - a GUID for the role assignment to create. The name must be unique and different for +// each role assignment. // parameters - parameters for the role assignment. func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { if tracing.IsEnabled() { @@ -275,7 +276,7 @@ func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -348,7 +349,7 @@ func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.R func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -519,6 +520,12 @@ func (client RoleAssignmentsClient) List(ctx context.Context, filter string) (re 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("authorization.RoleAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -625,7 +632,7 @@ func (client RoleAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets role assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -644,6 +651,15 @@ func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -677,7 +693,7 @@ func (client RoleAssignmentsClient) ListForResourcePreparer(ctx context.Context, "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -755,7 +771,7 @@ func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets role assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or // above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope // for the specified principal. @@ -770,6 +786,15 @@ func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go index d3ee5a13aca3..445a59445e3d 100644 --- a/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go +++ b/services/preview/authorization/mgmt/2018-01-01-preview/authorization/roledefinitions.go @@ -179,7 +179,7 @@ func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/CHANGELOG.md b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/CHANGELOG.md index 52911e4cc5e4..4140246fc17f 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/CHANGELOG.md +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/CHANGELOG.md @@ -1,2 +1,27 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Funcs + +1. Principal.MarshalJSON() ([]byte, error) + +## Additive Changes + +### New Funcs + +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorAdditionalInfo +1. ErrorDetail +1. ErrorResponse + +#### New Struct Fields + +1. Principal.DisplayName +1. Principal.Email diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/_meta.json b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/_meta.json index 631c62195cd4..a7313fb4143f 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/_meta.json +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2018-07-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/classicadministrators.go b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/classicadministrators.go index 71dc9f3cdf7e..adb9c2979f8e 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/classicadministrators.go +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/classicadministrators.go @@ -10,6 +10,7 @@ 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" ) @@ -43,6 +44,12 @@ func (client ClassicAdministratorsClient) List(ctx context.Context) (result Clas 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("authorization.ClassicAdministratorsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/denyassignments.go b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/denyassignments.go index f5d7d0387994..a98e1d59fbc9 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/denyassignments.go +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/denyassignments.go @@ -10,6 +10,7 @@ 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" ) @@ -203,6 +204,12 @@ func (client DenyAssignmentsClient) List(ctx context.Context, filter string) (re 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("authorization.DenyAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -309,7 +316,7 @@ func (client DenyAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets deny assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -334,6 +341,15 @@ func (client DenyAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.DenyAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -367,7 +383,7 @@ func (client DenyAssignmentsClient) ListForResourcePreparer(ctx context.Context, "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -445,7 +461,7 @@ func (client DenyAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets deny assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or // above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified // scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for @@ -466,6 +482,15 @@ func (client DenyAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.DenyAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/models.go b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/models.go index 372185e3e843..b45cd0bcface 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/models.go +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/models.go @@ -541,6 +541,47 @@ type DenyAssignmentProperties struct { IsSystemProtected *bool `json:"isSystemProtected,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // Permission role definition permissions. type Permission struct { // Actions - Allowed actions. @@ -712,18 +753,16 @@ func NewPermissionGetResultPage(cur PermissionGetResult, getNextPage func(contex } } -// Principal deny assignment principal. +// Principal the name of the entity last modified it type Principal struct { - // ID - READ-ONLY; Object ID of the Azure AD principal (user, group, or service principal) to which the deny assignment applies. An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + // ID - The id of the principal made changes ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Type of object represented by principal id (user, group, or service principal). An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + // DisplayName - The name of the principal made changes + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of principal such as user , group etc Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Principal. -func (p Principal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) + // Email - Email of principal + Email *string `json:"email,omitempty"` } // ProviderOperation operation diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/permissions.go b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/permissions.go index 62d87b8d120b..307f7a567df8 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/permissions.go +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/permissions.go @@ -10,6 +10,7 @@ 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" ) @@ -32,7 +33,7 @@ func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) Perm // ListForResource gets all permissions the caller has for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -48,6 +49,15 @@ func (client PermissionsClient) ListForResource(ctx context.Context, resourceGro 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("authorization.PermissionsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) if err != nil { @@ -81,7 +91,7 @@ func (client PermissionsClient) ListForResourcePreparer(ctx context.Context, res "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -156,7 +166,7 @@ func (client PermissionsClient) ListForResourceComplete(ctx context.Context, res // ListForResourceGroup gets all permissions the caller has for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") @@ -168,6 +178,15 @@ func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resour 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("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/provideroperationsmetadata.go b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/provideroperationsmetadata.go index 359c843c0826..77cb8b9768e9 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/provideroperationsmetadata.go +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/provideroperationsmetadata.go @@ -72,7 +72,7 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource // GetPreparer prepares the Get request. func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, } const APIVersion = "2018-01-01-preview" diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roleassignments.go b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roleassignments.go index bcfa975c050e..7b336b5c0750 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roleassignments.go +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roleassignments.go @@ -38,7 +38,8 @@ func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. -// roleAssignmentName - the name of the role assignment to create. It can be any valid GUID. +// roleAssignmentName - a GUID for the role assignment to create. The name must be unique and different for +// each role assignment. // parameters - parameters for the role assignment. func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { if tracing.IsEnabled() { @@ -275,7 +276,7 @@ func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -348,7 +349,7 @@ func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.R func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -519,6 +520,12 @@ func (client RoleAssignmentsClient) List(ctx context.Context, filter string) (re 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("authorization.RoleAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -625,7 +632,7 @@ func (client RoleAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets role assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -644,6 +651,15 @@ func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -677,7 +693,7 @@ func (client RoleAssignmentsClient) ListForResourcePreparer(ctx context.Context, "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -755,7 +771,7 @@ func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets role assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or // above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope // for the specified principal. @@ -770,6 +786,15 @@ func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roledefinitions.go b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roledefinitions.go index d3ee5a13aca3..445a59445e3d 100644 --- a/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roledefinitions.go +++ b/services/preview/authorization/mgmt/2018-07-01-preview/authorization/roledefinitions.go @@ -179,7 +179,7 @@ func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/CHANGELOG.md b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/CHANGELOG.md index 52911e4cc5e4..7ef2a39025c1 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/CHANGELOG.md +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/CHANGELOG.md @@ -1,2 +1,36 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. PrincipalType.Application +1. PrincipalType.DirectoryObjectOrGroup +1. PrincipalType.DirectoryRoleTemplate +1. PrincipalType.Everyone +1. PrincipalType.MSI +1. PrincipalType.Unknown + +### Removed Funcs + +1. Principal.MarshalJSON() ([]byte, error) + +## Additive Changes + +### New Funcs + +1. ErrorAdditionalInfo.MarshalJSON() ([]byte, error) +1. ErrorDetail.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. ErrorAdditionalInfo +1. ErrorDetail +1. ErrorResponse + +#### New Struct Fields + +1. Principal.DisplayName +1. Principal.Email diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/_meta.json b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/_meta.json index 85da6e0a024c..7c7af281a942 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/_meta.json +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2018-09-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/classicadministrators.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/classicadministrators.go index 71dc9f3cdf7e..adb9c2979f8e 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/classicadministrators.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/classicadministrators.go @@ -10,6 +10,7 @@ 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" ) @@ -43,6 +44,12 @@ func (client ClassicAdministratorsClient) List(ctx context.Context) (result Clas 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("authorization.ClassicAdministratorsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/denyassignments.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/denyassignments.go index f5d7d0387994..a98e1d59fbc9 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/denyassignments.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/denyassignments.go @@ -10,6 +10,7 @@ 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" ) @@ -203,6 +204,12 @@ func (client DenyAssignmentsClient) List(ctx context.Context, filter string) (re 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("authorization.DenyAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -309,7 +316,7 @@ func (client DenyAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets deny assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -334,6 +341,15 @@ func (client DenyAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.DenyAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -367,7 +383,7 @@ func (client DenyAssignmentsClient) ListForResourcePreparer(ctx context.Context, "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -445,7 +461,7 @@ func (client DenyAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets deny assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or // above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified // scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for @@ -466,6 +482,15 @@ func (client DenyAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.DenyAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/enums.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/enums.go index f0c637120a4f..55e1d9d6aac0 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/enums.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/enums.go @@ -10,29 +10,17 @@ package authorization type PrincipalType string const ( - // Application ... - Application PrincipalType = "Application" - // DirectoryObjectOrGroup ... - DirectoryObjectOrGroup PrincipalType = "DirectoryObjectOrGroup" - // DirectoryRoleTemplate ... - DirectoryRoleTemplate PrincipalType = "DirectoryRoleTemplate" - // Everyone ... - Everyone PrincipalType = "Everyone" // ForeignGroup ... ForeignGroup PrincipalType = "ForeignGroup" // Group ... Group PrincipalType = "Group" - // MSI ... - MSI PrincipalType = "MSI" // ServicePrincipal ... ServicePrincipal PrincipalType = "ServicePrincipal" - // Unknown ... - Unknown PrincipalType = "Unknown" // User ... User PrincipalType = "User" ) // PossiblePrincipalTypeValues returns an array of possible values for the PrincipalType const type. func PossiblePrincipalTypeValues() []PrincipalType { - return []PrincipalType{Application, DirectoryObjectOrGroup, DirectoryRoleTemplate, Everyone, ForeignGroup, Group, MSI, ServicePrincipal, Unknown, User} + return []PrincipalType{ForeignGroup, Group, ServicePrincipal, User} } diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/models.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/models.go index f4fb758e8ad7..5d2167267336 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/models.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/models.go @@ -541,6 +541,47 @@ type DenyAssignmentProperties struct { IsSystemProtected *bool `json:"isSystemProtected,omitempty"` } +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + // Permission role definition permissions. type Permission struct { // Actions - Allowed actions. @@ -712,18 +753,16 @@ func NewPermissionGetResultPage(cur PermissionGetResult, getNextPage func(contex } } -// Principal deny assignment principal. +// Principal the name of the entity last modified it type Principal struct { - // ID - READ-ONLY; Object ID of the Azure AD principal (user, group, or service principal) to which the deny assignment applies. An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + // ID - The id of the principal made changes ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Type of object represented by principal id (user, group, or service principal). An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + // DisplayName - The name of the principal made changes + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of principal such as user , group etc Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Principal. -func (p Principal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) + // Email - Email of principal + Email *string `json:"email,omitempty"` } // ProviderOperation operation @@ -1214,7 +1253,7 @@ type RoleAssignmentProperties struct { RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` // PrincipalID - The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. PrincipalID *string `json:"principalId,omitempty"` - // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'ForeignGroup' PrincipalType PrincipalType `json:"principalType,omitempty"` // CanDelegate - The delegation flag used for creating a role assignment CanDelegate *bool `json:"canDelegate,omitempty"` @@ -1228,7 +1267,7 @@ type RoleAssignmentPropertiesWithScope struct { RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` // PrincipalID - The principal ID. PrincipalID *string `json:"principalId,omitempty"` - // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'ForeignGroup' PrincipalType PrincipalType `json:"principalType,omitempty"` // CanDelegate - The Delegation flag for the role assignment CanDelegate *bool `json:"canDelegate,omitempty"` diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/permissions.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/permissions.go index 62d87b8d120b..307f7a567df8 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/permissions.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/permissions.go @@ -10,6 +10,7 @@ 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" ) @@ -32,7 +33,7 @@ func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) Perm // ListForResource gets all permissions the caller has for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -48,6 +49,15 @@ func (client PermissionsClient) ListForResource(ctx context.Context, resourceGro 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("authorization.PermissionsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) if err != nil { @@ -81,7 +91,7 @@ func (client PermissionsClient) ListForResourcePreparer(ctx context.Context, res "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -156,7 +166,7 @@ func (client PermissionsClient) ListForResourceComplete(ctx context.Context, res // ListForResourceGroup gets all permissions the caller has for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") @@ -168,6 +178,15 @@ func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resour 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("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/provideroperationsmetadata.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/provideroperationsmetadata.go index 359c843c0826..77cb8b9768e9 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/provideroperationsmetadata.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/provideroperationsmetadata.go @@ -72,7 +72,7 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource // GetPreparer prepares the Get request. func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, } const APIVersion = "2018-01-01-preview" diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roleassignments.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roleassignments.go index ea9b915211a1..221688361834 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roleassignments.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roleassignments.go @@ -38,7 +38,8 @@ func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. -// roleAssignmentName - the name of the role assignment to create. It can be any valid GUID. +// roleAssignmentName - a GUID for the role assignment to create. The name must be unique and different for +// each role assignment. // parameters - parameters for the role assignment. func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { if tracing.IsEnabled() { @@ -275,7 +276,7 @@ func (client RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -348,7 +349,7 @@ func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.R func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -519,6 +520,12 @@ func (client RoleAssignmentsClient) List(ctx context.Context, filter string) (re 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("authorization.RoleAssignmentsClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, filter) if err != nil { @@ -625,7 +632,7 @@ func (client RoleAssignmentsClient) ListComplete(ctx context.Context, filter str // ListForResource gets role assignments for a resource. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // resourceProviderNamespace - the namespace of the resource provider. // parentResourcePath - the parent resource identity. // resourceType - the resource type of the resource. @@ -644,6 +651,15 @@ func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) + } + result.fn = client.listForResourceNextResults req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) if err != nil { @@ -677,7 +693,7 @@ func (client RoleAssignmentsClient) ListForResourcePreparer(ctx context.Context, "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -755,7 +771,7 @@ func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, // ListForResourceGroup gets role assignments for a resource group. // Parameters: -// resourceGroupName - the name of the resource group. +// resourceGroupName - the name of the resource group. The name is case insensitive. // filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or // above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope // for the specified principal. @@ -770,6 +786,15 @@ func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) + } + result.fn = client.listForResourceGroupNextResults req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) if err != nil { diff --git a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roledefinitions.go b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roledefinitions.go index d3ee5a13aca3..445a59445e3d 100644 --- a/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roledefinitions.go +++ b/services/preview/authorization/mgmt/2018-09-01-preview/authorization/roledefinitions.go @@ -179,7 +179,7 @@ func (client RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Respo func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/CHANGELOG.md b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/CHANGELOG.md index 52911e4cc5e4..8f6597894ba6 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/CHANGELOG.md +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/CHANGELOG.md @@ -1,2 +1,25 @@ -# Change History +# Unreleased +## Breaking Changes + +### Removed Constants + +1. PrincipalType.Application +1. PrincipalType.DirectoryObjectOrGroup +1. PrincipalType.DirectoryRoleTemplate +1. PrincipalType.Everyone +1. PrincipalType.MSI +1. PrincipalType.Unknown + +### Removed Funcs + +1. Principal.MarshalJSON() ([]byte, error) + +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. Principal.DisplayName +1. Principal.Email diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/_meta.json b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/_meta.json index ffda37794b41..74223c330216 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/_meta.json +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/_meta.json @@ -1,5 +1,5 @@ { - "commit": "5fcc6854765009e891052653b304cfe80353430a", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", "tag": "package-2020-04-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/denyassignments.go b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/denyassignments.go index c2a2800232db..a98e1d59fbc9 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/denyassignments.go +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/denyassignments.go @@ -346,8 +346,7 @@ func (client DenyAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.DenyAssignmentsClient", "ListForResource", err.Error()) } @@ -384,7 +383,7 @@ func (client DenyAssignmentsClient) ListForResourcePreparer(ctx context.Context, "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -488,8 +487,7 @@ func (client DenyAssignmentsClient) ListForResourceGroup(ctx context.Context, re 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("authorization.DenyAssignmentsClient", "ListForResourceGroup", err.Error()) } diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/enums.go b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/enums.go index f0c637120a4f..55e1d9d6aac0 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/enums.go +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/enums.go @@ -10,29 +10,17 @@ package authorization type PrincipalType string const ( - // Application ... - Application PrincipalType = "Application" - // DirectoryObjectOrGroup ... - DirectoryObjectOrGroup PrincipalType = "DirectoryObjectOrGroup" - // DirectoryRoleTemplate ... - DirectoryRoleTemplate PrincipalType = "DirectoryRoleTemplate" - // Everyone ... - Everyone PrincipalType = "Everyone" // ForeignGroup ... ForeignGroup PrincipalType = "ForeignGroup" // Group ... Group PrincipalType = "Group" - // MSI ... - MSI PrincipalType = "MSI" // ServicePrincipal ... ServicePrincipal PrincipalType = "ServicePrincipal" - // Unknown ... - Unknown PrincipalType = "Unknown" // User ... User PrincipalType = "User" ) // PossiblePrincipalTypeValues returns an array of possible values for the PrincipalType const type. func PossiblePrincipalTypeValues() []PrincipalType { - return []PrincipalType{Application, DirectoryObjectOrGroup, DirectoryRoleTemplate, Everyone, ForeignGroup, Group, MSI, ServicePrincipal, Unknown, User} + return []PrincipalType{ForeignGroup, Group, ServicePrincipal, User} } diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/models.go b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/models.go index 20d9e396b809..95bc850ee417 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/models.go +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/models.go @@ -754,18 +754,16 @@ func NewPermissionGetResultPage(cur PermissionGetResult, getNextPage func(contex } } -// Principal deny assignment principal. +// Principal the name of the entity last modified it type Principal struct { - // ID - READ-ONLY; Object ID of the Azure AD principal (user, group, or service principal) to which the deny assignment applies. An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + // ID - The id of the principal made changes ID *string `json:"id,omitempty"` - // Type - READ-ONLY; Type of object represented by principal id (user, group, or service principal). An empty guid '00000000-0000-0000-0000-000000000000' as principal id and principal type as 'Everyone' represents all users, groups and service principals. + // DisplayName - The name of the principal made changes + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of principal such as user , group etc Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Principal. -func (p Principal) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) + // Email - Email of principal + Email *string `json:"email,omitempty"` } // ProviderOperation operation @@ -1275,7 +1273,7 @@ type RoleAssignmentProperties struct { RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` // PrincipalID - The principal ID assigned to the role. This maps to the ID inside the Active Directory. It can point to a user, service principal, or security group. PrincipalID *string `json:"principalId,omitempty"` - // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'ForeignGroup' PrincipalType PrincipalType `json:"principalType,omitempty"` // CanDelegate - The delegation flag used for creating a role assignment CanDelegate *bool `json:"canDelegate,omitempty"` @@ -1297,7 +1295,7 @@ type RoleAssignmentPropertiesWithScope struct { RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` // PrincipalID - The principal ID. PrincipalID *string `json:"principalId,omitempty"` - // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'Unknown', 'DirectoryRoleTemplate', 'ForeignGroup', 'Application', 'MSI', 'DirectoryObjectOrGroup', 'Everyone' + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'User', 'Group', 'ServicePrincipal', 'ForeignGroup' PrincipalType PrincipalType `json:"principalType,omitempty"` // CanDelegate - The Delegation flag for the role assignment CanDelegate *bool `json:"canDelegate,omitempty"` diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/permissions.go b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/permissions.go index 8c6135300b5f..307f7a567df8 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/permissions.go +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/permissions.go @@ -52,8 +52,7 @@ func (client PermissionsClient) ListForResource(ctx context.Context, resourceGro 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("authorization.PermissionsClient", "ListForResource", err.Error()) @@ -92,7 +91,7 @@ func (client PermissionsClient) ListForResourcePreparer(ctx context.Context, res "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -182,8 +181,7 @@ func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resour 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("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/provideroperationsmetadata.go b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/provideroperationsmetadata.go index 359c843c0826..77cb8b9768e9 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/provideroperationsmetadata.go +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/provideroperationsmetadata.go @@ -72,7 +72,7 @@ func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resource // GetPreparer prepares the Get request. func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, } const APIVersion = "2018-01-01-preview" diff --git a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignments.go b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignments.go index 53a25d6a5ae5..cc1ea1a25b46 100644 --- a/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignments.go +++ b/services/preview/authorization/mgmt/2020-04-01-preview/authorization/roleassignments.go @@ -38,7 +38,8 @@ func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and // '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' // for a resource. -// roleAssignmentName - the name of the role assignment to create. It can be any valid GUID. +// roleAssignmentName - a GUID for the role assignment to create. The name must be unique and different for +// each role assignment. // parameters - parameters for the role assignment. func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { if tracing.IsEnabled() { @@ -674,8 +675,7 @@ func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourc 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("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) @@ -714,7 +714,7 @@ func (client RoleAssignmentsClient) ListForResourcePreparer(ctx context.Context, "parentResourcePath": parentResourcePath, "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), - "resourceProviderNamespace": autorest.Encode("path", resourceProviderNamespace), + "resourceProviderNamespace": resourceProviderNamespace, "resourceType": resourceType, "subscriptionId": autorest.Encode("path", client.SubscriptionID), } @@ -814,8 +814,7 @@ func (client RoleAssignmentsClient) ListForResourceGroup(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("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/CHANGELOG.md b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/_meta.json b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/_meta.json new file mode 100644 index 000000000000..f34c0d6a9ab4 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", + "readme": "/_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", + "tag": "package-2020-10-01-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-10-01-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/authorization/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewdefaultsettings.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewdefaultsettings.go new file mode 100644 index 000000000000..f876eb68c27a --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewdefaultsettings.go @@ -0,0 +1,192 @@ +package authorization + +// 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" +) + +// AccessReviewDefaultSettingsClient is the client for the AccessReviewDefaultSettings methods of the Authorization +// service. +type AccessReviewDefaultSettingsClient struct { + BaseClient +} + +// NewAccessReviewDefaultSettingsClient creates an instance of the AccessReviewDefaultSettingsClient client. +func NewAccessReviewDefaultSettingsClient(subscriptionID string) AccessReviewDefaultSettingsClient { + return NewAccessReviewDefaultSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewDefaultSettingsClientWithBaseURI creates an instance of the AccessReviewDefaultSettingsClient 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 NewAccessReviewDefaultSettingsClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewDefaultSettingsClient { + return AccessReviewDefaultSettingsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get access review default settings for the subscription +func (client AccessReviewDefaultSettingsClient) Get(ctx context.Context) (result AccessReviewDefaultSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewDefaultSettingsClient.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("authorization.AccessReviewDefaultSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewDefaultSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewDefaultSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewDefaultSettingsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AccessReviewDefaultSettingsClient) GetPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/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 AccessReviewDefaultSettingsClient) 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 AccessReviewDefaultSettingsClient) GetResponder(resp *http.Response) (result AccessReviewDefaultSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Put get access review default settings for the subscription +// Parameters: +// properties - access review schedule settings. +func (client AccessReviewDefaultSettingsClient) Put(ctx context.Context, properties AccessReviewScheduleSettings) (result AccessReviewDefaultSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewDefaultSettingsClient.Put") + 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("authorization.AccessReviewDefaultSettingsClient", "Put", err.Error()) + } + + req, err := client.PutPreparer(ctx, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewDefaultSettingsClient", "Put", nil, "Failure preparing request") + return + } + + resp, err := client.PutSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewDefaultSettingsClient", "Put", resp, "Failure sending request") + return + } + + result, err = client.PutResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewDefaultSettingsClient", "Put", resp, "Failure responding to request") + return + } + + return +} + +// PutPreparer prepares the Put request. +func (client AccessReviewDefaultSettingsClient) PutPreparer(ctx context.Context, properties AccessReviewScheduleSettings) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleSettings/default", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PutSender sends the Put request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewDefaultSettingsClient) PutSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PutResponder handles the response to the Put request. The method always +// closes the http.Response Body. +func (client AccessReviewDefaultSettingsClient) PutResponder(resp *http.Response) (result AccessReviewDefaultSettings, 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/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstance.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstance.go new file mode 100644 index 000000000000..73c9b02c0223 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstance.go @@ -0,0 +1,431 @@ +package authorization + +// 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" +) + +// AccessReviewInstanceClient is the client for the AccessReviewInstance methods of the Authorization service. +type AccessReviewInstanceClient struct { + BaseClient +} + +// NewAccessReviewInstanceClient creates an instance of the AccessReviewInstanceClient client. +func NewAccessReviewInstanceClient(subscriptionID string) AccessReviewInstanceClient { + return NewAccessReviewInstanceClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewInstanceClientWithBaseURI creates an instance of the AccessReviewInstanceClient 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 NewAccessReviewInstanceClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewInstanceClient { + return AccessReviewInstanceClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AcceptRecommendations an action to accept recommendations for decision in an access review instance. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstanceClient) AcceptRecommendations(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceClient.AcceptRecommendations") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AcceptRecommendationsPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "AcceptRecommendations", nil, "Failure preparing request") + return + } + + resp, err := client.AcceptRecommendationsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "AcceptRecommendations", resp, "Failure sending request") + return + } + + result, err = client.AcceptRecommendationsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "AcceptRecommendations", resp, "Failure responding to request") + return + } + + return +} + +// AcceptRecommendationsPreparer prepares the AcceptRecommendations request. +func (client AccessReviewInstanceClient) AcceptRecommendationsPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/acceptRecommendations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AcceptRecommendationsSender sends the AcceptRecommendations request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceClient) AcceptRecommendationsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AcceptRecommendationsResponder handles the response to the AcceptRecommendations request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceClient) AcceptRecommendationsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ApplyDecisions an action to apply all decisions for an access review instance. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstanceClient) ApplyDecisions(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceClient.ApplyDecisions") + 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}}}}); err != nil { + return result, validation.NewError("authorization.AccessReviewInstanceClient", "ApplyDecisions", err.Error()) + } + + req, err := client.ApplyDecisionsPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "ApplyDecisions", nil, "Failure preparing request") + return + } + + resp, err := client.ApplyDecisionsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "ApplyDecisions", resp, "Failure sending request") + return + } + + result, err = client.ApplyDecisionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "ApplyDecisions", resp, "Failure responding to request") + return + } + + return +} + +// ApplyDecisionsPreparer prepares the ApplyDecisions request. +func (client AccessReviewInstanceClient) ApplyDecisionsPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/applyDecisions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ApplyDecisionsSender sends the ApplyDecisions request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceClient) ApplyDecisionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ApplyDecisionsResponder handles the response to the ApplyDecisions request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceClient) ApplyDecisionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// ResetDecisions an action to reset all decisions for an access review instance. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstanceClient) ResetDecisions(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceClient.ResetDecisions") + 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}}}}); err != nil { + return result, validation.NewError("authorization.AccessReviewInstanceClient", "ResetDecisions", err.Error()) + } + + req, err := client.ResetDecisionsPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "ResetDecisions", nil, "Failure preparing request") + return + } + + resp, err := client.ResetDecisionsSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "ResetDecisions", resp, "Failure sending request") + return + } + + result, err = client.ResetDecisionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "ResetDecisions", resp, "Failure responding to request") + return + } + + return +} + +// ResetDecisionsPreparer prepares the ResetDecisions request. +func (client AccessReviewInstanceClient) ResetDecisionsPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/resetDecisions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResetDecisionsSender sends the ResetDecisions request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceClient) ResetDecisionsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ResetDecisionsResponder handles the response to the ResetDecisions request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceClient) ResetDecisionsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// SendReminders an action to send reminders for an access review instance. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstanceClient) SendReminders(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceClient.SendReminders") + 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}}}}); err != nil { + return result, validation.NewError("authorization.AccessReviewInstanceClient", "SendReminders", err.Error()) + } + + req, err := client.SendRemindersPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "SendReminders", nil, "Failure preparing request") + return + } + + resp, err := client.SendRemindersSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "SendReminders", resp, "Failure sending request") + return + } + + result, err = client.SendRemindersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "SendReminders", resp, "Failure responding to request") + return + } + + return +} + +// SendRemindersPreparer prepares the SendReminders request. +func (client AccessReviewInstanceClient) SendRemindersPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/sendReminders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SendRemindersSender sends the SendReminders request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceClient) SendRemindersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SendRemindersResponder handles the response to the SendReminders request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceClient) SendRemindersResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop an action to stop an access review instance. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstanceClient) Stop(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceClient.Stop") + 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}}}}); err != nil { + return result, validation.NewError("authorization.AccessReviewInstanceClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceClient", "Stop", resp, "Failure responding to request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client AccessReviewInstanceClient) StopPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceClient) StopSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancedecisions.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancedecisions.go new file mode 100644 index 000000000000..172ecff25b28 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancedecisions.go @@ -0,0 +1,158 @@ +package authorization + +// 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" +) + +// AccessReviewInstanceDecisionsClient is the client for the AccessReviewInstanceDecisions methods of the Authorization +// service. +type AccessReviewInstanceDecisionsClient struct { + BaseClient +} + +// NewAccessReviewInstanceDecisionsClient creates an instance of the AccessReviewInstanceDecisionsClient client. +func NewAccessReviewInstanceDecisionsClient(subscriptionID string) AccessReviewInstanceDecisionsClient { + return NewAccessReviewInstanceDecisionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewInstanceDecisionsClientWithBaseURI creates an instance of the AccessReviewInstanceDecisionsClient +// 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 NewAccessReviewInstanceDecisionsClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewInstanceDecisionsClient { + return AccessReviewInstanceDecisionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get access review instance decisions +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstanceDecisionsClient) List(ctx context.Context, scheduleDefinitionID string, ID string) (result AccessReviewDecisionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceDecisionsClient.List") + defer func() { + sc := -1 + if result.ardlr.Response.Response != nil { + sc = result.ardlr.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("authorization.AccessReviewInstanceDecisionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceDecisionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ardlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceDecisionsClient", "List", resp, "Failure sending request") + return + } + + result.ardlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceDecisionsClient", "List", resp, "Failure responding to request") + return + } + if result.ardlr.hasNextLink() && result.ardlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccessReviewInstanceDecisionsClient) ListPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceDecisionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceDecisionsClient) ListResponder(resp *http.Response) (result AccessReviewDecisionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccessReviewInstanceDecisionsClient) listNextResults(ctx context.Context, lastResults AccessReviewDecisionListResult) (result AccessReviewDecisionListResult, err error) { + req, err := lastResults.accessReviewDecisionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceDecisionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceDecisionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceDecisionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccessReviewInstanceDecisionsClient) ListComplete(ctx context.Context, scheduleDefinitionID string, ID string) (result AccessReviewDecisionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceDecisionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scheduleDefinitionID, ID) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancemydecisions.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancemydecisions.go new file mode 100644 index 000000000000..dafebcad28f8 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancemydecisions.go @@ -0,0 +1,314 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// AccessReviewInstanceMyDecisionsClient is the client for the AccessReviewInstanceMyDecisions methods of the +// Authorization service. +type AccessReviewInstanceMyDecisionsClient struct { + BaseClient +} + +// NewAccessReviewInstanceMyDecisionsClient creates an instance of the AccessReviewInstanceMyDecisionsClient client. +func NewAccessReviewInstanceMyDecisionsClient(subscriptionID string) AccessReviewInstanceMyDecisionsClient { + return NewAccessReviewInstanceMyDecisionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewInstanceMyDecisionsClientWithBaseURI creates an instance of the AccessReviewInstanceMyDecisionsClient +// 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 NewAccessReviewInstanceMyDecisionsClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewInstanceMyDecisionsClient { + return AccessReviewInstanceMyDecisionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetByID get my single access review instance decision. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +// decisionID - the id of the decision record. +func (client AccessReviewInstanceMyDecisionsClient) GetByID(ctx context.Context, scheduleDefinitionID string, ID string, decisionID string) (result AccessReviewDecision, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceMyDecisionsClient.GetByID") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByIDPreparer(ctx, scheduleDefinitionID, ID, decisionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client AccessReviewInstanceMyDecisionsClient) GetByIDPreparer(ctx context.Context, scheduleDefinitionID string, ID string, decisionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "decisionId": autorest.Encode("path", decisionID), + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceMyDecisionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceMyDecisionsClient) GetByIDResponder(resp *http.Response) (result AccessReviewDecision, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get my access review instance decisions. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstanceMyDecisionsClient) List(ctx context.Context, scheduleDefinitionID string, ID string) (result AccessReviewDecisionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceMyDecisionsClient.List") + defer func() { + sc := -1 + if result.ardlr.Response.Response != nil { + sc = result.ardlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ardlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "List", resp, "Failure sending request") + return + } + + result.ardlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "List", resp, "Failure responding to request") + return + } + if result.ardlr.hasNextLink() && result.ardlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccessReviewInstanceMyDecisionsClient) ListPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceMyDecisionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceMyDecisionsClient) ListResponder(resp *http.Response) (result AccessReviewDecisionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccessReviewInstanceMyDecisionsClient) listNextResults(ctx context.Context, lastResults AccessReviewDecisionListResult) (result AccessReviewDecisionListResult, err error) { + req, err := lastResults.accessReviewDecisionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccessReviewInstanceMyDecisionsClient) ListComplete(ctx context.Context, scheduleDefinitionID string, ID string) (result AccessReviewDecisionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceMyDecisionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scheduleDefinitionID, ID) + return +} + +// Patch record a decision. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +// decisionID - the id of the decision record. +// properties - access review decision properties to patch. +func (client AccessReviewInstanceMyDecisionsClient) Patch(ctx context.Context, scheduleDefinitionID string, ID string, decisionID string, properties AccessReviewDecisionProperties) (result AccessReviewDecision, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceMyDecisionsClient.Patch") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.PatchPreparer(ctx, scheduleDefinitionID, ID, decisionID, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "Patch", nil, "Failure preparing request") + return + } + + resp, err := client.PatchSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "Patch", resp, "Failure sending request") + return + } + + result, err = client.PatchResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstanceMyDecisionsClient", "Patch", resp, "Failure responding to request") + return + } + + return +} + +// PatchPreparer prepares the Patch request. +func (client AccessReviewInstanceMyDecisionsClient) PatchPreparer(ctx context.Context, scheduleDefinitionID string, ID string, decisionID string, properties AccessReviewDecisionProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "decisionId": autorest.Encode("path", decisionID), + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + properties.BasicAccessReviewDecisionTarget = "" + properties.Recommendation = "" + properties.ReviewedDateTime = nil + properties.AccessReviewActorIdentity = nil + properties.ApplyResult = "" + properties.AppliedDateTime = nil + properties.AccessReviewActorIdentity = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}/decisions/{decisionId}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PatchSender sends the Patch request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstanceMyDecisionsClient) PatchSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// PatchResponder handles the response to the Patch request. The method always +// closes the http.Response Body. +func (client AccessReviewInstanceMyDecisionsClient) PatchResponder(resp *http.Response) (result AccessReviewDecision, 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/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstances.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstances.go new file mode 100644 index 000000000000..e92623afb892 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstances.go @@ -0,0 +1,237 @@ +package authorization + +// 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" +) + +// AccessReviewInstancesClient is the client for the AccessReviewInstances methods of the Authorization service. +type AccessReviewInstancesClient struct { + BaseClient +} + +// NewAccessReviewInstancesClient creates an instance of the AccessReviewInstancesClient client. +func NewAccessReviewInstancesClient(subscriptionID string) AccessReviewInstancesClient { + return NewAccessReviewInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewInstancesClientWithBaseURI creates an instance of the AccessReviewInstancesClient 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 NewAccessReviewInstancesClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewInstancesClient { + return AccessReviewInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetByID get access review instances +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstancesClient) GetByID(ctx context.Context, scheduleDefinitionID string, ID string) (result AccessReviewInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstancesClient.GetByID") + 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("authorization.AccessReviewInstancesClient", "GetByID", err.Error()) + } + + req, err := client.GetByIDPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client AccessReviewInstancesClient) GetByIDPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstancesClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client AccessReviewInstancesClient) GetByIDResponder(resp *http.Response) (result AccessReviewInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get access review instances +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +func (client AccessReviewInstancesClient) List(ctx context.Context, scheduleDefinitionID string) (result AccessReviewInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstancesClient.List") + defer func() { + sc := -1 + if result.arilr.Response.Response != nil { + sc = result.arilr.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("authorization.AccessReviewInstancesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scheduleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "List", resp, "Failure sending request") + return + } + + result.arilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "List", resp, "Failure responding to request") + return + } + if result.arilr.hasNextLink() && result.arilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccessReviewInstancesClient) ListPreparer(ctx context.Context, scheduleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstancesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccessReviewInstancesClient) ListResponder(resp *http.Response) (result AccessReviewInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccessReviewInstancesClient) listNextResults(ctx context.Context, lastResults AccessReviewInstanceListResult) (result AccessReviewInstanceListResult, err error) { + req, err := lastResults.accessReviewInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccessReviewInstancesClient) ListComplete(ctx context.Context, scheduleDefinitionID string) (result AccessReviewInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstancesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scheduleDefinitionID) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancesassignedformyapproval.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancesassignedformyapproval.go new file mode 100644 index 000000000000..5ef3522268ed --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewinstancesassignedformyapproval.go @@ -0,0 +1,224 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// AccessReviewInstancesAssignedForMyApprovalClient is the client for the AccessReviewInstancesAssignedForMyApproval +// methods of the Authorization service. +type AccessReviewInstancesAssignedForMyApprovalClient struct { + BaseClient +} + +// NewAccessReviewInstancesAssignedForMyApprovalClient creates an instance of the +// AccessReviewInstancesAssignedForMyApprovalClient client. +func NewAccessReviewInstancesAssignedForMyApprovalClient(subscriptionID string) AccessReviewInstancesAssignedForMyApprovalClient { + return NewAccessReviewInstancesAssignedForMyApprovalClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewInstancesAssignedForMyApprovalClientWithBaseURI creates an instance of the +// AccessReviewInstancesAssignedForMyApprovalClient 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 NewAccessReviewInstancesAssignedForMyApprovalClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewInstancesAssignedForMyApprovalClient { + return AccessReviewInstancesAssignedForMyApprovalClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetByID get single access review instance assigned for my approval. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// ID - the id of the access review instance. +func (client AccessReviewInstancesAssignedForMyApprovalClient) GetByID(ctx context.Context, scheduleDefinitionID string, ID string) (result AccessReviewInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstancesAssignedForMyApprovalClient.GetByID") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByIDPreparer(ctx, scheduleDefinitionID, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client AccessReviewInstancesAssignedForMyApprovalClient) GetByIDPreparer(ctx context.Context, scheduleDefinitionID string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances/{id}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstancesAssignedForMyApprovalClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client AccessReviewInstancesAssignedForMyApprovalClient) GetByIDResponder(resp *http.Response) (result AccessReviewInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get access review instances assigned for my approval. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +func (client AccessReviewInstancesAssignedForMyApprovalClient) List(ctx context.Context, scheduleDefinitionID string) (result AccessReviewInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstancesAssignedForMyApprovalClient.List") + defer func() { + sc := -1 + if result.arilr.Response.Response != nil { + sc = result.arilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scheduleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "List", resp, "Failure sending request") + return + } + + result.arilr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "List", resp, "Failure responding to request") + return + } + if result.arilr.hasNextLink() && result.arilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccessReviewInstancesAssignedForMyApprovalClient) ListPreparer(ctx context.Context, scheduleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/instances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewInstancesAssignedForMyApprovalClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccessReviewInstancesAssignedForMyApprovalClient) ListResponder(resp *http.Response) (result AccessReviewInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccessReviewInstancesAssignedForMyApprovalClient) listNextResults(ctx context.Context, lastResults AccessReviewInstanceListResult) (result AccessReviewInstanceListResult, err error) { + req, err := lastResults.accessReviewInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewInstancesAssignedForMyApprovalClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccessReviewInstancesAssignedForMyApprovalClient) ListComplete(ctx context.Context, scheduleDefinitionID string) (result AccessReviewInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstancesAssignedForMyApprovalClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scheduleDefinitionID) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewscheduledefinitions.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewscheduledefinitions.go new file mode 100644 index 000000000000..e6a9ad89db49 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewscheduledefinitions.go @@ -0,0 +1,478 @@ +package authorization + +// 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" +) + +// AccessReviewScheduleDefinitionsClient is the client for the AccessReviewScheduleDefinitions methods of the +// Authorization service. +type AccessReviewScheduleDefinitionsClient struct { + BaseClient +} + +// NewAccessReviewScheduleDefinitionsClient creates an instance of the AccessReviewScheduleDefinitionsClient client. +func NewAccessReviewScheduleDefinitionsClient(subscriptionID string) AccessReviewScheduleDefinitionsClient { + return NewAccessReviewScheduleDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewScheduleDefinitionsClientWithBaseURI creates an instance of the AccessReviewScheduleDefinitionsClient +// 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 NewAccessReviewScheduleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewScheduleDefinitionsClient { + return AccessReviewScheduleDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdateByID create or Update access review schedule definition. +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +// properties - access review schedule definition properties. +func (client AccessReviewScheduleDefinitionsClient) CreateOrUpdateByID(ctx context.Context, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties) (result AccessReviewScheduleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsClient.CreateOrUpdateByID") + 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("authorization.AccessReviewScheduleDefinitionsClient", "CreateOrUpdateByID", err.Error()) + } + + req, err := client.CreateOrUpdateByIDPreparer(ctx, scheduleDefinitionID, properties) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "CreateOrUpdateByID", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "CreateOrUpdateByID", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "CreateOrUpdateByID", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request. +func (client AccessReviewScheduleDefinitionsClient) CreateOrUpdateByIDPreparer(ctx context.Context, scheduleDefinitionID string, properties AccessReviewScheduleDefinitionProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + properties.Status = "" + properties.AccessReviewActorIdentity = nil + properties.AccessReviewScope = nil + properties.ReviewersType = "" + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}", pathParameters), + autorest.WithJSON(properties), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewScheduleDefinitionsClient) CreateOrUpdateByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always +// closes the http.Response Body. +func (client AccessReviewScheduleDefinitionsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result AccessReviewScheduleDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteByID delete access review schedule definition +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +func (client AccessReviewScheduleDefinitionsClient) DeleteByID(ctx context.Context, scheduleDefinitionID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsClient.DeleteByID") + 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}}}}); err != nil { + return result, validation.NewError("authorization.AccessReviewScheduleDefinitionsClient", "DeleteByID", err.Error()) + } + + req, err := client.DeleteByIDPreparer(ctx, scheduleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "DeleteByID", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByIDSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "DeleteByID", resp, "Failure sending request") + return + } + + result, err = client.DeleteByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "DeleteByID", resp, "Failure responding to request") + return + } + + return +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client AccessReviewScheduleDefinitionsClient) DeleteByIDPreparer(ctx context.Context, scheduleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteByIDSender sends the DeleteByID request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewScheduleDefinitionsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteByIDResponder handles the response to the DeleteByID request. The method always +// closes the http.Response Body. +func (client AccessReviewScheduleDefinitionsClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetByID get single access review definition +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +func (client AccessReviewScheduleDefinitionsClient) GetByID(ctx context.Context, scheduleDefinitionID string) (result AccessReviewScheduleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsClient.GetByID") + 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("authorization.AccessReviewScheduleDefinitionsClient", "GetByID", err.Error()) + } + + req, err := client.GetByIDPreparer(ctx, scheduleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client AccessReviewScheduleDefinitionsClient) GetByIDPreparer(ctx context.Context, scheduleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewScheduleDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client AccessReviewScheduleDefinitionsClient) GetByIDResponder(resp *http.Response) (result AccessReviewScheduleDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get access review schedule definitions +func (client AccessReviewScheduleDefinitionsClient) List(ctx context.Context) (result AccessReviewScheduleDefinitionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsClient.List") + defer func() { + sc := -1 + if result.arsdlr.Response.Response != nil { + sc = result.arsdlr.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("authorization.AccessReviewScheduleDefinitionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arsdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result.arsdlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "List", resp, "Failure responding to request") + return + } + if result.arsdlr.hasNextLink() && result.arsdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccessReviewScheduleDefinitionsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewScheduleDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccessReviewScheduleDefinitionsClient) ListResponder(resp *http.Response) (result AccessReviewScheduleDefinitionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccessReviewScheduleDefinitionsClient) listNextResults(ctx context.Context, lastResults AccessReviewScheduleDefinitionListResult) (result AccessReviewScheduleDefinitionListResult, err error) { + req, err := lastResults.accessReviewScheduleDefinitionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccessReviewScheduleDefinitionsClient) ListComplete(ctx context.Context) (result AccessReviewScheduleDefinitionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// Stop stop access review definition +// Parameters: +// scheduleDefinitionID - the id of the access review schedule definition. +func (client AccessReviewScheduleDefinitionsClient) Stop(ctx context.Context, scheduleDefinitionID string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsClient.Stop") + 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}}}}); err != nil { + return result, validation.NewError("authorization.AccessReviewScheduleDefinitionsClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, scheduleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsClient", "Stop", resp, "Failure responding to request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client AccessReviewScheduleDefinitionsClient) StopPreparer(ctx context.Context, scheduleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scheduleDefinitionId": autorest.Encode("path", scheduleDefinitionID), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/accessReviewScheduleDefinitions/{scheduleDefinitionId}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewScheduleDefinitionsClient) StopSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client AccessReviewScheduleDefinitionsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewscheduledefinitionsassignedformyapproval.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewscheduledefinitionsassignedformyapproval.go new file mode 100644 index 000000000000..00ee473e8606 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/accessreviewscheduledefinitionsassignedformyapproval.go @@ -0,0 +1,143 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClient is the client for the +// AccessReviewScheduleDefinitionsAssignedForMyApproval methods of the Authorization service. +type AccessReviewScheduleDefinitionsAssignedForMyApprovalClient struct { + BaseClient +} + +// NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient creates an instance of the +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClient client. +func NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(subscriptionID string) AccessReviewScheduleDefinitionsAssignedForMyApprovalClient { + return NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClientWithBaseURI creates an instance of the +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClient 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 NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClientWithBaseURI(baseURI string, subscriptionID string) AccessReviewScheduleDefinitionsAssignedForMyApprovalClient { + return AccessReviewScheduleDefinitionsAssignedForMyApprovalClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get access review instances assigned for my approval. +func (client AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) List(ctx context.Context) (result AccessReviewScheduleDefinitionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.List") + defer func() { + sc := -1 + if result.arsdlr.Response.Response != nil { + sc = result.arsdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arsdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", "List", resp, "Failure sending request") + return + } + + result.arsdlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", "List", resp, "Failure responding to request") + return + } + if result.arsdlr.hasNextLink() && result.arsdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Authorization/accessReviewScheduleDefinitions"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) ListResponder(resp *http.Response) (result AccessReviewScheduleDefinitionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) listNextResults(ctx context.Context, lastResults AccessReviewScheduleDefinitionListResult) (result AccessReviewScheduleDefinitionListResult, err error) { + req, err := lastResults.accessReviewScheduleDefinitionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) ListComplete(ctx context.Context) (result AccessReviewScheduleDefinitionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionsAssignedForMyApprovalClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/authorizationapi/interfaces.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/authorizationapi/interfaces.go new file mode 100644 index 000000000000..bec21e9e83f7 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/authorizationapi/interfaces.go @@ -0,0 +1,260 @@ +package authorizationapi + +// 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/azure-sdk-for-go/services/preview/authorization/mgmt/2020-10-01-preview/authorization" + "github.com/Azure/go-autorest/autorest" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result authorization.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result authorization.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*authorization.OperationsClient)(nil) + +// AccessReviewScheduleDefinitionsClientAPI contains the set of methods on the AccessReviewScheduleDefinitionsClient type. +type AccessReviewScheduleDefinitionsClientAPI interface { + CreateOrUpdateByID(ctx context.Context, scheduleDefinitionID string, properties authorization.AccessReviewScheduleDefinitionProperties) (result authorization.AccessReviewScheduleDefinition, err error) + DeleteByID(ctx context.Context, scheduleDefinitionID string) (result autorest.Response, err error) + GetByID(ctx context.Context, scheduleDefinitionID string) (result authorization.AccessReviewScheduleDefinition, err error) + List(ctx context.Context) (result authorization.AccessReviewScheduleDefinitionListResultPage, err error) + ListComplete(ctx context.Context) (result authorization.AccessReviewScheduleDefinitionListResultIterator, err error) + Stop(ctx context.Context, scheduleDefinitionID string) (result autorest.Response, err error) +} + +var _ AccessReviewScheduleDefinitionsClientAPI = (*authorization.AccessReviewScheduleDefinitionsClient)(nil) + +// AccessReviewInstancesClientAPI contains the set of methods on the AccessReviewInstancesClient type. +type AccessReviewInstancesClientAPI interface { + GetByID(ctx context.Context, scheduleDefinitionID string, ID string) (result authorization.AccessReviewInstance, err error) + List(ctx context.Context, scheduleDefinitionID string) (result authorization.AccessReviewInstanceListResultPage, err error) + ListComplete(ctx context.Context, scheduleDefinitionID string) (result authorization.AccessReviewInstanceListResultIterator, err error) +} + +var _ AccessReviewInstancesClientAPI = (*authorization.AccessReviewInstancesClient)(nil) + +// AccessReviewInstanceClientAPI contains the set of methods on the AccessReviewInstanceClient type. +type AccessReviewInstanceClientAPI interface { + AcceptRecommendations(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) + ApplyDecisions(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) + ResetDecisions(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) + SendReminders(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) + Stop(ctx context.Context, scheduleDefinitionID string, ID string) (result autorest.Response, err error) +} + +var _ AccessReviewInstanceClientAPI = (*authorization.AccessReviewInstanceClient)(nil) + +// AccessReviewInstanceDecisionsClientAPI contains the set of methods on the AccessReviewInstanceDecisionsClient type. +type AccessReviewInstanceDecisionsClientAPI interface { + List(ctx context.Context, scheduleDefinitionID string, ID string) (result authorization.AccessReviewDecisionListResultPage, err error) + ListComplete(ctx context.Context, scheduleDefinitionID string, ID string) (result authorization.AccessReviewDecisionListResultIterator, err error) +} + +var _ AccessReviewInstanceDecisionsClientAPI = (*authorization.AccessReviewInstanceDecisionsClient)(nil) + +// AccessReviewDefaultSettingsClientAPI contains the set of methods on the AccessReviewDefaultSettingsClient type. +type AccessReviewDefaultSettingsClientAPI interface { + Get(ctx context.Context) (result authorization.AccessReviewDefaultSettings, err error) + Put(ctx context.Context, properties authorization.AccessReviewScheduleSettings) (result authorization.AccessReviewDefaultSettings, err error) +} + +var _ AccessReviewDefaultSettingsClientAPI = (*authorization.AccessReviewDefaultSettingsClient)(nil) + +// AccessReviewScheduleDefinitionsAssignedForMyApprovalClientAPI contains the set of methods on the AccessReviewScheduleDefinitionsAssignedForMyApprovalClient type. +type AccessReviewScheduleDefinitionsAssignedForMyApprovalClientAPI interface { + List(ctx context.Context) (result authorization.AccessReviewScheduleDefinitionListResultPage, err error) + ListComplete(ctx context.Context) (result authorization.AccessReviewScheduleDefinitionListResultIterator, err error) +} + +var _ AccessReviewScheduleDefinitionsAssignedForMyApprovalClientAPI = (*authorization.AccessReviewScheduleDefinitionsAssignedForMyApprovalClient)(nil) + +// AccessReviewInstancesAssignedForMyApprovalClientAPI contains the set of methods on the AccessReviewInstancesAssignedForMyApprovalClient type. +type AccessReviewInstancesAssignedForMyApprovalClientAPI interface { + GetByID(ctx context.Context, scheduleDefinitionID string, ID string) (result authorization.AccessReviewInstance, err error) + List(ctx context.Context, scheduleDefinitionID string) (result authorization.AccessReviewInstanceListResultPage, err error) + ListComplete(ctx context.Context, scheduleDefinitionID string) (result authorization.AccessReviewInstanceListResultIterator, err error) +} + +var _ AccessReviewInstancesAssignedForMyApprovalClientAPI = (*authorization.AccessReviewInstancesAssignedForMyApprovalClient)(nil) + +// AccessReviewInstanceMyDecisionsClientAPI contains the set of methods on the AccessReviewInstanceMyDecisionsClient type. +type AccessReviewInstanceMyDecisionsClientAPI interface { + GetByID(ctx context.Context, scheduleDefinitionID string, ID string, decisionID string) (result authorization.AccessReviewDecision, err error) + List(ctx context.Context, scheduleDefinitionID string, ID string) (result authorization.AccessReviewDecisionListResultPage, err error) + ListComplete(ctx context.Context, scheduleDefinitionID string, ID string) (result authorization.AccessReviewDecisionListResultIterator, err error) + Patch(ctx context.Context, scheduleDefinitionID string, ID string, decisionID string, properties authorization.AccessReviewDecisionProperties) (result authorization.AccessReviewDecision, err error) +} + +var _ AccessReviewInstanceMyDecisionsClientAPI = (*authorization.AccessReviewInstanceMyDecisionsClient)(nil) + +// DenyAssignmentsClientAPI contains the set of methods on the DenyAssignmentsClient type. +type DenyAssignmentsClientAPI interface { + Get(ctx context.Context, scope string, denyAssignmentID string) (result authorization.DenyAssignment, err error) + GetByID(ctx context.Context, denyAssignmentID string) (result authorization.DenyAssignment, err error) + List(ctx context.Context, filter string) (result authorization.DenyAssignmentListResultPage, err error) + ListComplete(ctx context.Context, filter string) (result authorization.DenyAssignmentListResultIterator, err error) + ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result authorization.DenyAssignmentListResultPage, err error) + ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result authorization.DenyAssignmentListResultIterator, err error) + ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result authorization.DenyAssignmentListResultPage, err error) + ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result authorization.DenyAssignmentListResultIterator, err error) + ListForScope(ctx context.Context, scope string, filter string) (result authorization.DenyAssignmentListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string) (result authorization.DenyAssignmentListResultIterator, err error) +} + +var _ DenyAssignmentsClientAPI = (*authorization.DenyAssignmentsClient)(nil) + +// ProviderOperationsMetadataClientAPI contains the set of methods on the ProviderOperationsMetadataClient type. +type ProviderOperationsMetadataClientAPI interface { + Get(ctx context.Context, resourceProviderNamespace string, expand string) (result authorization.ProviderOperationsMetadata, err error) + List(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultPage, err error) + ListComplete(ctx context.Context, expand string) (result authorization.ProviderOperationsMetadataListResultIterator, err error) +} + +var _ ProviderOperationsMetadataClientAPI = (*authorization.ProviderOperationsMetadataClient)(nil) + +// RoleAssignmentsClientAPI contains the set of methods on the RoleAssignmentsClient type. +type RoleAssignmentsClientAPI interface { + Create(ctx context.Context, scope string, roleAssignmentName string, parameters authorization.RoleAssignmentCreateParameters) (result authorization.RoleAssignment, err error) + CreateByID(ctx context.Context, roleAssignmentID string, parameters authorization.RoleAssignmentCreateParameters) (result authorization.RoleAssignment, err error) + Delete(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (result authorization.RoleAssignment, err error) + DeleteByID(ctx context.Context, roleAssignmentID string, tenantID string) (result authorization.RoleAssignment, err error) + Get(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (result authorization.RoleAssignment, err error) + GetByID(ctx context.Context, roleAssignmentID string, tenantID string) (result authorization.RoleAssignment, err error) + ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, filter string, tenantID string) (result authorization.RoleAssignmentListResultPage, err error) + ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, filter string, tenantID string) (result authorization.RoleAssignmentListResultIterator, err error) + ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string, tenantID string) (result authorization.RoleAssignmentListResultPage, err error) + ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, tenantID string) (result authorization.RoleAssignmentListResultIterator, err error) + ListForScope(ctx context.Context, scope string, filter string, tenantID string) (result authorization.RoleAssignmentListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string, tenantID string) (result authorization.RoleAssignmentListResultIterator, err error) + ListForSubscription(ctx context.Context, filter string, tenantID string) (result authorization.RoleAssignmentListResultPage, err error) + ListForSubscriptionComplete(ctx context.Context, filter string, tenantID string) (result authorization.RoleAssignmentListResultIterator, err error) + Validate(ctx context.Context, scope string, roleAssignmentName string, parameters authorization.RoleAssignmentCreateParameters) (result authorization.ValidationResponse, err error) + ValidateByID(ctx context.Context, roleAssignmentID string, parameters authorization.RoleAssignmentCreateParameters) (result authorization.ValidationResponse, err error) +} + +var _ RoleAssignmentsClientAPI = (*authorization.RoleAssignmentsClient)(nil) + +// PermissionsClientAPI contains the set of methods on the PermissionsClient type. +type PermissionsClientAPI interface { + ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result authorization.PermissionGetResultPage, err error) + ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result authorization.PermissionGetResultIterator, err error) + ListForResourceGroup(ctx context.Context, resourceGroupName string) (result authorization.PermissionGetResultPage, err error) + ListForResourceGroupComplete(ctx context.Context, resourceGroupName string) (result authorization.PermissionGetResultIterator, err error) +} + +var _ PermissionsClientAPI = (*authorization.PermissionsClient)(nil) + +// RoleDefinitionsClientAPI contains the set of methods on the RoleDefinitionsClient type. +type RoleDefinitionsClientAPI interface { + CreateOrUpdate(ctx context.Context, scope string, roleDefinitionID string, roleDefinition authorization.RoleDefinition) (result authorization.RoleDefinition, err error) + Delete(ctx context.Context, scope string, roleDefinitionID string) (result authorization.RoleDefinition, err error) + Get(ctx context.Context, scope string, roleDefinitionID string) (result authorization.RoleDefinition, err error) + GetByID(ctx context.Context, roleID string) (result authorization.RoleDefinition, err error) + List(ctx context.Context, scope string, filter string) (result authorization.RoleDefinitionListResultPage, err error) + ListComplete(ctx context.Context, scope string, filter string) (result authorization.RoleDefinitionListResultIterator, err error) +} + +var _ RoleDefinitionsClientAPI = (*authorization.RoleDefinitionsClient)(nil) + +// RoleAssignmentMetricsClientAPI contains the set of methods on the RoleAssignmentMetricsClient type. +type RoleAssignmentMetricsClientAPI interface { + GetMetricsForSubscription(ctx context.Context) (result authorization.RoleAssignmentMetricsResult, err error) +} + +var _ RoleAssignmentMetricsClientAPI = (*authorization.RoleAssignmentMetricsClient)(nil) + +// EligibleChildResourcesClientAPI contains the set of methods on the EligibleChildResourcesClient type. +type EligibleChildResourcesClientAPI interface { + Get(ctx context.Context, scope string, filter string) (result authorization.EligibleChildResourcesListResultPage, err error) + GetComplete(ctx context.Context, scope string, filter string) (result authorization.EligibleChildResourcesListResultIterator, err error) +} + +var _ EligibleChildResourcesClientAPI = (*authorization.EligibleChildResourcesClient)(nil) + +// RoleAssignmentSchedulesClientAPI contains the set of methods on the RoleAssignmentSchedulesClient type. +type RoleAssignmentSchedulesClientAPI interface { + Get(ctx context.Context, scope string, roleAssignmentScheduleName string) (result authorization.RoleAssignmentSchedule, err error) + ListForScope(ctx context.Context, scope string, filter string) (result authorization.RoleAssignmentScheduleListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string) (result authorization.RoleAssignmentScheduleListResultIterator, err error) +} + +var _ RoleAssignmentSchedulesClientAPI = (*authorization.RoleAssignmentSchedulesClient)(nil) + +// RoleAssignmentScheduleInstancesClientAPI contains the set of methods on the RoleAssignmentScheduleInstancesClient type. +type RoleAssignmentScheduleInstancesClientAPI interface { + Get(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string) (result authorization.RoleAssignmentScheduleInstance, err error) + ListForScope(ctx context.Context, scope string, filter string) (result authorization.RoleAssignmentScheduleInstanceListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string) (result authorization.RoleAssignmentScheduleInstanceListResultIterator, err error) +} + +var _ RoleAssignmentScheduleInstancesClientAPI = (*authorization.RoleAssignmentScheduleInstancesClient)(nil) + +// RoleAssignmentScheduleRequestsClientAPI contains the set of methods on the RoleAssignmentScheduleRequestsClient type. +type RoleAssignmentScheduleRequestsClientAPI interface { + Cancel(ctx context.Context, scope string, roleAssignmentScheduleRequestName string) (result autorest.Response, err error) + Create(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters authorization.RoleAssignmentScheduleRequest) (result authorization.RoleAssignmentScheduleRequest, err error) + Get(ctx context.Context, scope string, roleAssignmentScheduleRequestName string) (result authorization.RoleAssignmentScheduleRequest, err error) + ListForScope(ctx context.Context, scope string, filter string) (result authorization.RoleAssignmentScheduleRequestListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string) (result authorization.RoleAssignmentScheduleRequestListResultIterator, err error) +} + +var _ RoleAssignmentScheduleRequestsClientAPI = (*authorization.RoleAssignmentScheduleRequestsClient)(nil) + +// RoleEligibilitySchedulesClientAPI contains the set of methods on the RoleEligibilitySchedulesClient type. +type RoleEligibilitySchedulesClientAPI interface { + Get(ctx context.Context, scope string, roleEligibilityScheduleName string) (result authorization.RoleEligibilitySchedule, err error) + ListForScope(ctx context.Context, scope string, filter string) (result authorization.RoleEligibilityScheduleListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string) (result authorization.RoleEligibilityScheduleListResultIterator, err error) +} + +var _ RoleEligibilitySchedulesClientAPI = (*authorization.RoleEligibilitySchedulesClient)(nil) + +// RoleEligibilityScheduleInstancesClientAPI contains the set of methods on the RoleEligibilityScheduleInstancesClient type. +type RoleEligibilityScheduleInstancesClientAPI interface { + Get(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string) (result authorization.RoleEligibilityScheduleInstance, err error) + ListForScope(ctx context.Context, scope string, filter string) (result authorization.RoleEligibilityScheduleInstanceListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string) (result authorization.RoleEligibilityScheduleInstanceListResultIterator, err error) +} + +var _ RoleEligibilityScheduleInstancesClientAPI = (*authorization.RoleEligibilityScheduleInstancesClient)(nil) + +// RoleEligibilityScheduleRequestsClientAPI contains the set of methods on the RoleEligibilityScheduleRequestsClient type. +type RoleEligibilityScheduleRequestsClientAPI interface { + Cancel(ctx context.Context, scope string, roleEligibilityScheduleRequestName string) (result autorest.Response, err error) + Create(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters authorization.RoleEligibilityScheduleRequest) (result authorization.RoleEligibilityScheduleRequest, err error) + Get(ctx context.Context, scope string, roleEligibilityScheduleRequestName string) (result authorization.RoleEligibilityScheduleRequest, err error) + ListForScope(ctx context.Context, scope string, filter string) (result authorization.RoleEligibilityScheduleRequestListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string, filter string) (result authorization.RoleEligibilityScheduleRequestListResultIterator, err error) +} + +var _ RoleEligibilityScheduleRequestsClientAPI = (*authorization.RoleEligibilityScheduleRequestsClient)(nil) + +// RoleManagementPoliciesClientAPI contains the set of methods on the RoleManagementPoliciesClient type. +type RoleManagementPoliciesClientAPI interface { + Delete(ctx context.Context, scope string, roleManagementPolicyName string) (result autorest.Response, err error) + Get(ctx context.Context, scope string, roleManagementPolicyName string) (result authorization.RoleManagementPolicy, err error) + ListForScope(ctx context.Context, scope string) (result authorization.RoleManagementPolicyListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string) (result authorization.RoleManagementPolicyListResultIterator, err error) + Update(ctx context.Context, scope string, roleManagementPolicyName string, parameters authorization.RoleManagementPolicy) (result authorization.RoleManagementPolicy, err error) +} + +var _ RoleManagementPoliciesClientAPI = (*authorization.RoleManagementPoliciesClient)(nil) + +// RoleManagementPolicyAssignmentsClientAPI contains the set of methods on the RoleManagementPolicyAssignmentsClient type. +type RoleManagementPolicyAssignmentsClientAPI interface { + Create(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters authorization.RoleManagementPolicyAssignment) (result authorization.RoleManagementPolicyAssignment, err error) + Delete(ctx context.Context, scope string, roleManagementPolicyAssignmentName string) (result autorest.Response, err error) + Get(ctx context.Context, scope string, roleManagementPolicyAssignmentName string) (result authorization.RoleManagementPolicyAssignment, err error) + ListForScope(ctx context.Context, scope string) (result authorization.RoleManagementPolicyAssignmentListResultPage, err error) + ListForScopeComplete(ctx context.Context, scope string) (result authorization.RoleManagementPolicyAssignmentListResultIterator, err error) +} + +var _ RoleManagementPolicyAssignmentsClientAPI = (*authorization.RoleManagementPolicyAssignmentsClient)(nil) diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/client.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/client.go similarity index 80% rename from services/preview/appinsights/mgmt/2020-02-02-preview/insights/client.go rename to services/preview/authorization/mgmt/2020-10-01-preview/authorization/client.go index 9203ed850c0c..8accd9738c11 100644 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/client.go +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/client.go @@ -1,7 +1,7 @@ -// Package insights implements the Azure ARM Insights service API version . +// Package authorization implements the Azure ARM Authorization service API version . // -// Composite Swagger for Application Insights Management Client -package insights +// +package authorization // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,11 +14,11 @@ import ( ) const ( - // DefaultBaseURI is the default URI used for the service Insights + // DefaultBaseURI is the default URI used for the service Authorization DefaultBaseURI = "https://management.azure.com" ) -// BaseClient is the base client for Insights. +// BaseClient is the base client for Authorization. type BaseClient struct { autorest.Client BaseURI string diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/denyassignments.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/denyassignments.go new file mode 100644 index 000000000000..a98e1d59fbc9 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/denyassignments.go @@ -0,0 +1,724 @@ +package authorization + +// 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" +) + +// DenyAssignmentsClient is the client for the DenyAssignments methods of the Authorization service. +type DenyAssignmentsClient struct { + BaseClient +} + +// NewDenyAssignmentsClient creates an instance of the DenyAssignmentsClient client. +func NewDenyAssignmentsClient(subscriptionID string) DenyAssignmentsClient { + return NewDenyAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDenyAssignmentsClientWithBaseURI creates an instance of the DenyAssignmentsClient 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 NewDenyAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) DenyAssignmentsClient { + return DenyAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the specified deny assignment. +// Parameters: +// scope - the scope of the deny assignment. +// denyAssignmentID - the ID of the deny assignment to get. +func (client DenyAssignmentsClient) Get(ctx context.Context, scope string, denyAssignmentID string) (result DenyAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, denyAssignmentID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DenyAssignmentsClient) GetPreparer(ctx context.Context, scope string, denyAssignmentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "denyAssignmentId": autorest.Encode("path", denyAssignmentID), + "scope": scope, + } + + const APIVersion = "2018-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}", 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 DenyAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DenyAssignmentsClient) GetResponder(resp *http.Response) (result DenyAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID gets a deny assignment by ID. +// Parameters: +// denyAssignmentID - the fully qualified deny assignment ID. For example, use the format, +// /subscriptions/{guid}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for subscription +// level deny assignments, or /providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId} for tenant +// level deny assignments. +func (client DenyAssignmentsClient) GetByID(ctx context.Context, denyAssignmentID string) (result DenyAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.GetByID") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByIDPreparer(ctx, denyAssignmentID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client DenyAssignmentsClient) GetByIDPreparer(ctx context.Context, denyAssignmentID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "denyAssignmentId": denyAssignmentID, + } + + const APIVersion = "2018-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{denyAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client DenyAssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client DenyAssignmentsClient) GetByIDResponder(resp *http.Response) (result DenyAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets all deny assignments for the subscription. +// Parameters: +// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or +// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified +// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for +// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, +// above and below the scope for the specified principal. This filter is different from the principalId filter +// as it returns not only those deny assignments that contain the specified principal is the Principals list +// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. +// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description +// properties are returned. +func (client DenyAssignmentsClient) List(ctx context.Context, filter string) (result DenyAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.List") + defer func() { + sc := -1 + if result.dalr.Response.Response != nil { + sc = result.dalr.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("authorization.DenyAssignmentsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "List", resp, "Failure sending request") + return + } + + result.dalr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "List", resp, "Failure responding to request") + return + } + if result.dalr.hasNextLink() && result.dalr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client DenyAssignmentsClient) ListPreparer(ctx context.Context, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/denyAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DenyAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DenyAssignmentsClient) ListResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DenyAssignmentsClient) listNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { + req, err := lastResults.denyAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DenyAssignmentsClient) ListComplete(ctx context.Context, filter string) (result DenyAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, filter) + return +} + +// ListForResource gets deny assignments for a resource. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource. +// resourceName - the name of the resource to get deny assignments for. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or +// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified +// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for +// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, +// above and below the scope for the specified principal. This filter is different from the principalId filter +// as it returns not only those deny assignments that contain the specified principal is the Principals list +// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. +// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description +// properties are returned. +func (client DenyAssignmentsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result DenyAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResource") + defer func() { + sc := -1 + if result.dalr.Response.Response != nil { + sc = result.dalr.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("authorization.DenyAssignmentsClient", "ListForResource", err.Error()) + } + + result.fn = client.listForResourceNextResults + req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.dalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResource", resp, "Failure sending request") + return + } + + result.dalr, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResource", resp, "Failure responding to request") + return + } + if result.dalr.hasNextLink() && result.dalr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForResourcePreparer prepares the ListForResource request. +func (client DenyAssignmentsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": resourceProviderNamespace, + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/denyAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForResourceSender sends the ListForResource request. The method will close the +// http.Response Body if it receives an error. +func (client DenyAssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForResourceResponder handles the response to the ListForResource request. The method always +// closes the http.Response Body. +func (client DenyAssignmentsClient) ListForResourceResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForResourceNextResults retrieves the next set of results, if any. +func (client DenyAssignmentsClient) listForResourceNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { + req, err := lastResults.denyAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client DenyAssignmentsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string, filter string) (result DenyAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResource") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, filter) + return +} + +// ListForResourceGroup gets deny assignments for a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or +// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified +// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for +// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, +// above and below the scope for the specified principal. This filter is different from the principalId filter +// as it returns not only those deny assignments that contain the specified principal is the Principals list +// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. +// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description +// properties are returned. +func (client DenyAssignmentsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string) (result DenyAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResourceGroup") + defer func() { + sc := -1 + if result.dalr.Response.Response != nil { + sc = result.dalr.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("authorization.DenyAssignmentsClient", "ListForResourceGroup", err.Error()) + } + + result.fn = client.listForResourceGroupNextResults + req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.dalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result.dalr, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") + return + } + if result.dalr.hasNextLink() && result.dalr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client DenyAssignmentsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/denyAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DenyAssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client DenyAssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForResourceGroupNextResults retrieves the next set of results, if any. +func (client DenyAssignmentsClient) listForResourceGroupNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { + req, err := lastResults.denyAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DenyAssignmentsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string) (result DenyAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForResourceGroup(ctx, resourceGroupName, filter) + return +} + +// ListForScope gets deny assignments for a scope. +// Parameters: +// scope - the scope of the deny assignments. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all deny assignments at or +// above the scope. Use $filter=denyAssignmentName eq '{name}' to search deny assignments by name at specified +// scope. Use $filter=principalId eq '{id}' to return all deny assignments at, above and below the scope for +// the specified principal. Use $filter=gdprExportPrincipalId eq '{id}' to return all deny assignments at, +// above and below the scope for the specified principal. This filter is different from the principalId filter +// as it returns not only those deny assignments that contain the specified principal is the Principals list +// but also those deny assignments that contain the specified principal is the ExcludePrincipals list. +// Additionally, when gdprExportPrincipalId filter is used, only the deny assignment name and description +// properties are returned. +func (client DenyAssignmentsClient) ListForScope(ctx context.Context, scope string, filter string) (result DenyAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForScope") + defer func() { + sc := -1 + if result.dalr.Response.Response != nil { + sc = result.dalr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.dalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForScope", resp, "Failure sending request") + return + } + + result.dalr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.dalr.hasNextLink() && result.dalr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client DenyAssignmentsClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2018-07-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/denyAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client DenyAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client DenyAssignmentsClient) ListForScopeResponder(resp *http.Response) (result DenyAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client DenyAssignmentsClient) listForScopeNextResults(ctx context.Context, lastResults DenyAssignmentListResult) (result DenyAssignmentListResult, err error) { + req, err := lastResults.denyAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.DenyAssignmentsClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client DenyAssignmentsClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result DenyAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentsClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/eligiblechildresources.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/eligiblechildresources.go new file mode 100644 index 000000000000..4147bf99da2f --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/eligiblechildresources.go @@ -0,0 +1,154 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// EligibleChildResourcesClient is the client for the EligibleChildResources methods of the Authorization service. +type EligibleChildResourcesClient struct { + BaseClient +} + +// NewEligibleChildResourcesClient creates an instance of the EligibleChildResourcesClient client. +func NewEligibleChildResourcesClient(subscriptionID string) EligibleChildResourcesClient { + return NewEligibleChildResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEligibleChildResourcesClientWithBaseURI creates an instance of the EligibleChildResourcesClient 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 NewEligibleChildResourcesClientWithBaseURI(baseURI string, subscriptionID string) EligibleChildResourcesClient { + return EligibleChildResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the child resources of a resource on which user has eligible access +// Parameters: +// scope - the scope of the role management policy. +// filter - the filter to apply on the operation. Use $filter=resourceType+eq+'Subscription' to filter on only +// resource of type = 'Subscription'. Use +// $filter=resourceType+eq+'subscription'+or+resourceType+eq+'resourcegroup' to filter on resource of type = +// 'Subscription' or 'ResourceGroup' +func (client EligibleChildResourcesClient) Get(ctx context.Context, scope string, filter string) (result EligibleChildResourcesListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EligibleChildResourcesClient.Get") + defer func() { + sc := -1 + if result.ecrlr.Response.Response != nil { + sc = result.ecrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.getNextResults + req, err := client.GetPreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.EligibleChildResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.ecrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.EligibleChildResourcesClient", "Get", resp, "Failure sending request") + return + } + + result.ecrlr, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.EligibleChildResourcesClient", "Get", resp, "Failure responding to request") + return + } + if result.ecrlr.hasNextLink() && result.ecrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EligibleChildResourcesClient) GetPreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/eligibleChildResources", 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 EligibleChildResourcesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client EligibleChildResourcesClient) GetResponder(resp *http.Response) (result EligibleChildResourcesListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// getNextResults retrieves the next set of results, if any. +func (client EligibleChildResourcesClient) getNextResults(ctx context.Context, lastResults EligibleChildResourcesListResult) (result EligibleChildResourcesListResult, err error) { + req, err := lastResults.eligibleChildResourcesListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.EligibleChildResourcesClient", "getNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.EligibleChildResourcesClient", "getNextResults", resp, "Failure sending next results request") + } + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.EligibleChildResourcesClient", "getNextResults", resp, "Failure responding to next results request") + } + return +} + +// GetComplete enumerates all values, automatically crossing page boundaries as required. +func (client EligibleChildResourcesClient) GetComplete(ctx context.Context, scope string, filter string) (result EligibleChildResourcesListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EligibleChildResourcesClient.Get") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.Get(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/enums.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/enums.go new file mode 100644 index 000000000000..6e5fdf8c248f --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/enums.go @@ -0,0 +1,559 @@ +package authorization + +// 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. + +// AccessRecommendationType enumerates the values for access recommendation type. +type AccessRecommendationType string + +const ( + // Approve ... + Approve AccessRecommendationType = "Approve" + // Deny ... + Deny AccessRecommendationType = "Deny" + // NoInfoAvailable ... + NoInfoAvailable AccessRecommendationType = "NoInfoAvailable" +) + +// PossibleAccessRecommendationTypeValues returns an array of possible values for the AccessRecommendationType const type. +func PossibleAccessRecommendationTypeValues() []AccessRecommendationType { + return []AccessRecommendationType{Approve, Deny, NoInfoAvailable} +} + +// AccessReviewActorIdentityType enumerates the values for access review actor identity type. +type AccessReviewActorIdentityType string + +const ( + // ServicePrincipal ... + ServicePrincipal AccessReviewActorIdentityType = "servicePrincipal" + // User ... + User AccessReviewActorIdentityType = "user" +) + +// PossibleAccessReviewActorIdentityTypeValues returns an array of possible values for the AccessReviewActorIdentityType const type. +func PossibleAccessReviewActorIdentityTypeValues() []AccessReviewActorIdentityType { + return []AccessReviewActorIdentityType{ServicePrincipal, User} +} + +// AccessReviewApplyResult enumerates the values for access review apply result. +type AccessReviewApplyResult string + +const ( + // AccessReviewApplyResultAppliedSuccessfully ... + AccessReviewApplyResultAppliedSuccessfully AccessReviewApplyResult = "AppliedSuccessfully" + // AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound ... + AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound AccessReviewApplyResult = "AppliedSuccessfullyButObjectNotFound" + // AccessReviewApplyResultAppliedWithUnknownFailure ... + AccessReviewApplyResultAppliedWithUnknownFailure AccessReviewApplyResult = "AppliedWithUnknownFailure" + // AccessReviewApplyResultApplying ... + AccessReviewApplyResultApplying AccessReviewApplyResult = "Applying" + // AccessReviewApplyResultApplyNotSupported ... + AccessReviewApplyResultApplyNotSupported AccessReviewApplyResult = "ApplyNotSupported" + // AccessReviewApplyResultNew ... + AccessReviewApplyResultNew AccessReviewApplyResult = "New" +) + +// PossibleAccessReviewApplyResultValues returns an array of possible values for the AccessReviewApplyResult const type. +func PossibleAccessReviewApplyResultValues() []AccessReviewApplyResult { + return []AccessReviewApplyResult{AccessReviewApplyResultAppliedSuccessfully, AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound, AccessReviewApplyResultAppliedWithUnknownFailure, AccessReviewApplyResultApplying, AccessReviewApplyResultApplyNotSupported, AccessReviewApplyResultNew} +} + +// AccessReviewInstanceStatus enumerates the values for access review instance status. +type AccessReviewInstanceStatus string + +const ( + // Applied ... + Applied AccessReviewInstanceStatus = "Applied" + // Applying ... + Applying AccessReviewInstanceStatus = "Applying" + // AutoReviewed ... + AutoReviewed AccessReviewInstanceStatus = "AutoReviewed" + // AutoReviewing ... + AutoReviewing AccessReviewInstanceStatus = "AutoReviewing" + // Completed ... + Completed AccessReviewInstanceStatus = "Completed" + // Completing ... + Completing AccessReviewInstanceStatus = "Completing" + // Initializing ... + Initializing AccessReviewInstanceStatus = "Initializing" + // InProgress ... + InProgress AccessReviewInstanceStatus = "InProgress" + // NotStarted ... + NotStarted AccessReviewInstanceStatus = "NotStarted" + // Scheduled ... + Scheduled AccessReviewInstanceStatus = "Scheduled" + // Starting ... + Starting AccessReviewInstanceStatus = "Starting" +) + +// PossibleAccessReviewInstanceStatusValues returns an array of possible values for the AccessReviewInstanceStatus const type. +func PossibleAccessReviewInstanceStatusValues() []AccessReviewInstanceStatus { + return []AccessReviewInstanceStatus{Applied, Applying, AutoReviewed, AutoReviewing, Completed, Completing, Initializing, InProgress, NotStarted, Scheduled, Starting} +} + +// AccessReviewRecurrencePatternType enumerates the values for access review recurrence pattern type. +type AccessReviewRecurrencePatternType string + +const ( + // AbsoluteMonthly ... + AbsoluteMonthly AccessReviewRecurrencePatternType = "absoluteMonthly" + // Weekly ... + Weekly AccessReviewRecurrencePatternType = "weekly" +) + +// PossibleAccessReviewRecurrencePatternTypeValues returns an array of possible values for the AccessReviewRecurrencePatternType const type. +func PossibleAccessReviewRecurrencePatternTypeValues() []AccessReviewRecurrencePatternType { + return []AccessReviewRecurrencePatternType{AbsoluteMonthly, Weekly} +} + +// AccessReviewRecurrenceRangeType enumerates the values for access review recurrence range type. +type AccessReviewRecurrenceRangeType string + +const ( + // EndDate ... + EndDate AccessReviewRecurrenceRangeType = "endDate" + // NoEnd ... + NoEnd AccessReviewRecurrenceRangeType = "noEnd" + // Numbered ... + Numbered AccessReviewRecurrenceRangeType = "numbered" +) + +// PossibleAccessReviewRecurrenceRangeTypeValues returns an array of possible values for the AccessReviewRecurrenceRangeType const type. +func PossibleAccessReviewRecurrenceRangeTypeValues() []AccessReviewRecurrenceRangeType { + return []AccessReviewRecurrenceRangeType{EndDate, NoEnd, Numbered} +} + +// AccessReviewResult enumerates the values for access review result. +type AccessReviewResult string + +const ( + // AccessReviewResultApprove ... + AccessReviewResultApprove AccessReviewResult = "Approve" + // AccessReviewResultDeny ... + AccessReviewResultDeny AccessReviewResult = "Deny" + // AccessReviewResultDontKnow ... + AccessReviewResultDontKnow AccessReviewResult = "DontKnow" + // AccessReviewResultNotNotified ... + AccessReviewResultNotNotified AccessReviewResult = "NotNotified" + // AccessReviewResultNotReviewed ... + AccessReviewResultNotReviewed AccessReviewResult = "NotReviewed" +) + +// PossibleAccessReviewResultValues returns an array of possible values for the AccessReviewResult const type. +func PossibleAccessReviewResultValues() []AccessReviewResult { + return []AccessReviewResult{AccessReviewResultApprove, AccessReviewResultDeny, AccessReviewResultDontKnow, AccessReviewResultNotNotified, AccessReviewResultNotReviewed} +} + +// AccessReviewReviewerType enumerates the values for access review reviewer type. +type AccessReviewReviewerType string + +const ( + // AccessReviewReviewerTypeServicePrincipal ... + AccessReviewReviewerTypeServicePrincipal AccessReviewReviewerType = "servicePrincipal" + // AccessReviewReviewerTypeUser ... + AccessReviewReviewerTypeUser AccessReviewReviewerType = "user" +) + +// PossibleAccessReviewReviewerTypeValues returns an array of possible values for the AccessReviewReviewerType const type. +func PossibleAccessReviewReviewerTypeValues() []AccessReviewReviewerType { + return []AccessReviewReviewerType{AccessReviewReviewerTypeServicePrincipal, AccessReviewReviewerTypeUser} +} + +// AccessReviewScheduleDefinitionReviewersType enumerates the values for access review schedule definition +// reviewers type. +type AccessReviewScheduleDefinitionReviewersType string + +const ( + // Assigned ... + Assigned AccessReviewScheduleDefinitionReviewersType = "Assigned" + // Managers ... + Managers AccessReviewScheduleDefinitionReviewersType = "Managers" + // Self ... + Self AccessReviewScheduleDefinitionReviewersType = "Self" +) + +// PossibleAccessReviewScheduleDefinitionReviewersTypeValues returns an array of possible values for the AccessReviewScheduleDefinitionReviewersType const type. +func PossibleAccessReviewScheduleDefinitionReviewersTypeValues() []AccessReviewScheduleDefinitionReviewersType { + return []AccessReviewScheduleDefinitionReviewersType{Assigned, Managers, Self} +} + +// AccessReviewScheduleDefinitionStatus enumerates the values for access review schedule definition status. +type AccessReviewScheduleDefinitionStatus string + +const ( + // AccessReviewScheduleDefinitionStatusApplied ... + AccessReviewScheduleDefinitionStatusApplied AccessReviewScheduleDefinitionStatus = "Applied" + // AccessReviewScheduleDefinitionStatusApplying ... + AccessReviewScheduleDefinitionStatusApplying AccessReviewScheduleDefinitionStatus = "Applying" + // AccessReviewScheduleDefinitionStatusAutoReviewed ... + AccessReviewScheduleDefinitionStatusAutoReviewed AccessReviewScheduleDefinitionStatus = "AutoReviewed" + // AccessReviewScheduleDefinitionStatusAutoReviewing ... + AccessReviewScheduleDefinitionStatusAutoReviewing AccessReviewScheduleDefinitionStatus = "AutoReviewing" + // AccessReviewScheduleDefinitionStatusCompleted ... + AccessReviewScheduleDefinitionStatusCompleted AccessReviewScheduleDefinitionStatus = "Completed" + // AccessReviewScheduleDefinitionStatusCompleting ... + AccessReviewScheduleDefinitionStatusCompleting AccessReviewScheduleDefinitionStatus = "Completing" + // AccessReviewScheduleDefinitionStatusInitializing ... + AccessReviewScheduleDefinitionStatusInitializing AccessReviewScheduleDefinitionStatus = "Initializing" + // AccessReviewScheduleDefinitionStatusInProgress ... + AccessReviewScheduleDefinitionStatusInProgress AccessReviewScheduleDefinitionStatus = "InProgress" + // AccessReviewScheduleDefinitionStatusNotStarted ... + AccessReviewScheduleDefinitionStatusNotStarted AccessReviewScheduleDefinitionStatus = "NotStarted" + // AccessReviewScheduleDefinitionStatusScheduled ... + AccessReviewScheduleDefinitionStatusScheduled AccessReviewScheduleDefinitionStatus = "Scheduled" + // AccessReviewScheduleDefinitionStatusStarting ... + AccessReviewScheduleDefinitionStatusStarting AccessReviewScheduleDefinitionStatus = "Starting" +) + +// PossibleAccessReviewScheduleDefinitionStatusValues returns an array of possible values for the AccessReviewScheduleDefinitionStatus const type. +func PossibleAccessReviewScheduleDefinitionStatusValues() []AccessReviewScheduleDefinitionStatus { + return []AccessReviewScheduleDefinitionStatus{AccessReviewScheduleDefinitionStatusApplied, AccessReviewScheduleDefinitionStatusApplying, AccessReviewScheduleDefinitionStatusAutoReviewed, AccessReviewScheduleDefinitionStatusAutoReviewing, AccessReviewScheduleDefinitionStatusCompleted, AccessReviewScheduleDefinitionStatusCompleting, AccessReviewScheduleDefinitionStatusInitializing, AccessReviewScheduleDefinitionStatusInProgress, AccessReviewScheduleDefinitionStatusNotStarted, AccessReviewScheduleDefinitionStatusScheduled, AccessReviewScheduleDefinitionStatusStarting} +} + +// AccessReviewScopePrincipalType enumerates the values for access review scope principal type. +type AccessReviewScopePrincipalType string + +const ( + // AccessReviewScopePrincipalTypeServicePrincipal ... + AccessReviewScopePrincipalTypeServicePrincipal AccessReviewScopePrincipalType = "servicePrincipal" + // AccessReviewScopePrincipalTypeUser ... + AccessReviewScopePrincipalTypeUser AccessReviewScopePrincipalType = "user" +) + +// PossibleAccessReviewScopePrincipalTypeValues returns an array of possible values for the AccessReviewScopePrincipalType const type. +func PossibleAccessReviewScopePrincipalTypeValues() []AccessReviewScopePrincipalType { + return []AccessReviewScopePrincipalType{AccessReviewScopePrincipalTypeServicePrincipal, AccessReviewScopePrincipalTypeUser} +} + +// ApprovalMode enumerates the values for approval mode. +type ApprovalMode string + +const ( + // NoApproval ... + NoApproval ApprovalMode = "NoApproval" + // Parallel ... + Parallel ApprovalMode = "Parallel" + // Serial ... + Serial ApprovalMode = "Serial" + // SingleStage ... + SingleStage ApprovalMode = "SingleStage" +) + +// PossibleApprovalModeValues returns an array of possible values for the ApprovalMode const type. +func PossibleApprovalModeValues() []ApprovalMode { + return []ApprovalMode{NoApproval, Parallel, Serial, SingleStage} +} + +// AssignmentType enumerates the values for assignment type. +type AssignmentType string + +const ( + // AssignmentTypeActivated ... + AssignmentTypeActivated AssignmentType = "Activated" + // AssignmentTypeAssigned ... + AssignmentTypeAssigned AssignmentType = "Assigned" +) + +// PossibleAssignmentTypeValues returns an array of possible values for the AssignmentType const type. +func PossibleAssignmentTypeValues() []AssignmentType { + return []AssignmentType{AssignmentTypeActivated, AssignmentTypeAssigned} +} + +// DefaultDecisionType enumerates the values for default decision type. +type DefaultDecisionType string + +const ( + // DefaultDecisionTypeApprove ... + DefaultDecisionTypeApprove DefaultDecisionType = "Approve" + // DefaultDecisionTypeDeny ... + DefaultDecisionTypeDeny DefaultDecisionType = "Deny" + // DefaultDecisionTypeRecommendation ... + DefaultDecisionTypeRecommendation DefaultDecisionType = "Recommendation" +) + +// PossibleDefaultDecisionTypeValues returns an array of possible values for the DefaultDecisionType const type. +func PossibleDefaultDecisionTypeValues() []DefaultDecisionType { + return []DefaultDecisionType{DefaultDecisionTypeApprove, DefaultDecisionTypeDeny, DefaultDecisionTypeRecommendation} +} + +// EnablementRules enumerates the values for enablement rules. +type EnablementRules string + +const ( + // Justification ... + Justification EnablementRules = "Justification" + // MultiFactorAuthentication ... + MultiFactorAuthentication EnablementRules = "MultiFactorAuthentication" + // Ticketing ... + Ticketing EnablementRules = "Ticketing" +) + +// PossibleEnablementRulesValues returns an array of possible values for the EnablementRules const type. +func PossibleEnablementRulesValues() []EnablementRules { + return []EnablementRules{Justification, MultiFactorAuthentication, Ticketing} +} + +// MemberType enumerates the values for member type. +type MemberType string + +const ( + // Direct ... + Direct MemberType = "Direct" + // Group ... + Group MemberType = "Group" + // Inherited ... + Inherited MemberType = "Inherited" +) + +// PossibleMemberTypeValues returns an array of possible values for the MemberType const type. +func PossibleMemberTypeValues() []MemberType { + return []MemberType{Direct, Group, Inherited} +} + +// NotificationDeliveryMechanism enumerates the values for notification delivery mechanism. +type NotificationDeliveryMechanism string + +const ( + // Email ... + Email NotificationDeliveryMechanism = "Email" +) + +// PossibleNotificationDeliveryMechanismValues returns an array of possible values for the NotificationDeliveryMechanism const type. +func PossibleNotificationDeliveryMechanismValues() []NotificationDeliveryMechanism { + return []NotificationDeliveryMechanism{Email} +} + +// NotificationLevel enumerates the values for notification level. +type NotificationLevel string + +const ( + // All ... + All NotificationLevel = "All" + // Critical ... + Critical NotificationLevel = "Critical" + // None ... + None NotificationLevel = "None" +) + +// PossibleNotificationLevelValues returns an array of possible values for the NotificationLevel const type. +func PossibleNotificationLevelValues() []NotificationLevel { + return []NotificationLevel{All, Critical, None} +} + +// PrincipalType enumerates the values for principal type. +type PrincipalType string + +const ( + // PrincipalTypeDevice ... + PrincipalTypeDevice PrincipalType = "Device" + // PrincipalTypeForeignGroup ... + PrincipalTypeForeignGroup PrincipalType = "ForeignGroup" + // PrincipalTypeGroup ... + PrincipalTypeGroup PrincipalType = "Group" + // PrincipalTypeServicePrincipal ... + PrincipalTypeServicePrincipal PrincipalType = "ServicePrincipal" + // PrincipalTypeUser ... + PrincipalTypeUser PrincipalType = "User" +) + +// PossiblePrincipalTypeValues returns an array of possible values for the PrincipalType const type. +func PossiblePrincipalTypeValues() []PrincipalType { + return []PrincipalType{PrincipalTypeDevice, PrincipalTypeForeignGroup, PrincipalTypeGroup, PrincipalTypeServicePrincipal, PrincipalTypeUser} +} + +// RecipientType enumerates the values for recipient type. +type RecipientType string + +const ( + // Admin ... + Admin RecipientType = "Admin" + // Approver ... + Approver RecipientType = "Approver" + // Requestor ... + Requestor RecipientType = "Requestor" +) + +// PossibleRecipientTypeValues returns an array of possible values for the RecipientType const type. +func PossibleRecipientTypeValues() []RecipientType { + return []RecipientType{Admin, Approver, Requestor} +} + +// RequestType enumerates the values for request type. +type RequestType string + +const ( + // AdminAssign ... + AdminAssign RequestType = "AdminAssign" + // AdminExtend ... + AdminExtend RequestType = "AdminExtend" + // AdminRemove ... + AdminRemove RequestType = "AdminRemove" + // AdminRenew ... + AdminRenew RequestType = "AdminRenew" + // AdminUpdate ... + AdminUpdate RequestType = "AdminUpdate" + // SelfActivate ... + SelfActivate RequestType = "SelfActivate" + // SelfDeactivate ... + SelfDeactivate RequestType = "SelfDeactivate" + // SelfExtend ... + SelfExtend RequestType = "SelfExtend" + // SelfRenew ... + SelfRenew RequestType = "SelfRenew" +) + +// PossibleRequestTypeValues returns an array of possible values for the RequestType const type. +func PossibleRequestTypeValues() []RequestType { + return []RequestType{AdminAssign, AdminExtend, AdminRemove, AdminRenew, AdminUpdate, SelfActivate, SelfDeactivate, SelfExtend, SelfRenew} +} + +// RoleManagementPolicyRuleType enumerates the values for role management policy rule type. +type RoleManagementPolicyRuleType string + +const ( + // RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule ... + RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule RoleManagementPolicyRuleType = "RoleManagementPolicyApprovalRule" + // RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule ... + RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule RoleManagementPolicyRuleType = "RoleManagementPolicyAuthenticationContextRule" + // RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule ... + RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule RoleManagementPolicyRuleType = "RoleManagementPolicyEnablementRule" + // RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule ... + RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule RoleManagementPolicyRuleType = "RoleManagementPolicyExpirationRule" + // RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule ... + RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule RoleManagementPolicyRuleType = "RoleManagementPolicyNotificationRule" +) + +// PossibleRoleManagementPolicyRuleTypeValues returns an array of possible values for the RoleManagementPolicyRuleType const type. +func PossibleRoleManagementPolicyRuleTypeValues() []RoleManagementPolicyRuleType { + return []RoleManagementPolicyRuleType{RoleManagementPolicyRuleTypeRoleManagementPolicyApprovalRule, RoleManagementPolicyRuleTypeRoleManagementPolicyAuthenticationContextRule, RoleManagementPolicyRuleTypeRoleManagementPolicyEnablementRule, RoleManagementPolicyRuleTypeRoleManagementPolicyExpirationRule, RoleManagementPolicyRuleTypeRoleManagementPolicyNotificationRule} +} + +// RuleType enumerates the values for rule type. +type RuleType string + +const ( + // RuleTypeRoleManagementPolicyApprovalRule ... + RuleTypeRoleManagementPolicyApprovalRule RuleType = "RoleManagementPolicyApprovalRule" + // RuleTypeRoleManagementPolicyAuthenticationContextRule ... + RuleTypeRoleManagementPolicyAuthenticationContextRule RuleType = "RoleManagementPolicyAuthenticationContextRule" + // RuleTypeRoleManagementPolicyEnablementRule ... + RuleTypeRoleManagementPolicyEnablementRule RuleType = "RoleManagementPolicyEnablementRule" + // RuleTypeRoleManagementPolicyExpirationRule ... + RuleTypeRoleManagementPolicyExpirationRule RuleType = "RoleManagementPolicyExpirationRule" + // RuleTypeRoleManagementPolicyNotificationRule ... + RuleTypeRoleManagementPolicyNotificationRule RuleType = "RoleManagementPolicyNotificationRule" + // RuleTypeRoleManagementPolicyRule ... + RuleTypeRoleManagementPolicyRule RuleType = "RoleManagementPolicyRule" +) + +// PossibleRuleTypeValues returns an array of possible values for the RuleType const type. +func PossibleRuleTypeValues() []RuleType { + return []RuleType{RuleTypeRoleManagementPolicyApprovalRule, RuleTypeRoleManagementPolicyAuthenticationContextRule, RuleTypeRoleManagementPolicyEnablementRule, RuleTypeRoleManagementPolicyExpirationRule, RuleTypeRoleManagementPolicyNotificationRule, RuleTypeRoleManagementPolicyRule} +} + +// Status enumerates the values for status. +type Status string + +const ( + // Accepted ... + Accepted Status = "Accepted" + // AdminApproved ... + AdminApproved Status = "AdminApproved" + // AdminDenied ... + AdminDenied Status = "AdminDenied" + // Canceled ... + Canceled Status = "Canceled" + // Denied ... + Denied Status = "Denied" + // Failed ... + Failed Status = "Failed" + // FailedAsResourceIsLocked ... + FailedAsResourceIsLocked Status = "FailedAsResourceIsLocked" + // Granted ... + Granted Status = "Granted" + // Invalid ... + Invalid Status = "Invalid" + // PendingAdminDecision ... + PendingAdminDecision Status = "PendingAdminDecision" + // PendingApproval ... + PendingApproval Status = "PendingApproval" + // PendingApprovalProvisioning ... + PendingApprovalProvisioning Status = "PendingApprovalProvisioning" + // PendingEvaluation ... + PendingEvaluation Status = "PendingEvaluation" + // PendingExternalProvisioning ... + PendingExternalProvisioning Status = "PendingExternalProvisioning" + // PendingProvisioning ... + PendingProvisioning Status = "PendingProvisioning" + // PendingRevocation ... + PendingRevocation Status = "PendingRevocation" + // PendingScheduleCreation ... + PendingScheduleCreation Status = "PendingScheduleCreation" + // Provisioned ... + Provisioned Status = "Provisioned" + // ProvisioningStarted ... + ProvisioningStarted Status = "ProvisioningStarted" + // Revoked ... + Revoked Status = "Revoked" + // ScheduleCreated ... + ScheduleCreated Status = "ScheduleCreated" + // TimedOut ... + TimedOut Status = "TimedOut" +) + +// PossibleStatusValues returns an array of possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{Accepted, AdminApproved, AdminDenied, Canceled, Denied, Failed, FailedAsResourceIsLocked, Granted, Invalid, PendingAdminDecision, PendingApproval, PendingApprovalProvisioning, PendingEvaluation, PendingExternalProvisioning, PendingProvisioning, PendingRevocation, PendingScheduleCreation, Provisioned, ProvisioningStarted, Revoked, ScheduleCreated, TimedOut} +} + +// Type enumerates the values for type. +type Type string + +const ( + // AfterDateTime ... + AfterDateTime Type = "AfterDateTime" + // AfterDuration ... + AfterDuration Type = "AfterDuration" + // NoExpiration ... + NoExpiration Type = "NoExpiration" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{AfterDateTime, AfterDuration, NoExpiration} +} + +// TypeBasicAccessReviewDecisionTarget enumerates the values for type basic access review decision target. +type TypeBasicAccessReviewDecisionTarget string + +const ( + // TypeAccessReviewDecisionTarget ... + TypeAccessReviewDecisionTarget TypeBasicAccessReviewDecisionTarget = "AccessReviewDecisionTarget" + // TypeServicePrincipal ... + TypeServicePrincipal TypeBasicAccessReviewDecisionTarget = "servicePrincipal" + // TypeUser ... + TypeUser TypeBasicAccessReviewDecisionTarget = "user" +) + +// PossibleTypeBasicAccessReviewDecisionTargetValues returns an array of possible values for the TypeBasicAccessReviewDecisionTarget const type. +func PossibleTypeBasicAccessReviewDecisionTargetValues() []TypeBasicAccessReviewDecisionTarget { + return []TypeBasicAccessReviewDecisionTarget{TypeAccessReviewDecisionTarget, TypeServicePrincipal, TypeUser} +} + +// UserType enumerates the values for user type. +type UserType string + +const ( + // UserTypeGroup ... + UserTypeGroup UserType = "Group" + // UserTypeUser ... + UserTypeUser UserType = "User" +) + +// PossibleUserTypeValues returns an array of possible values for the UserType const type. +func PossibleUserTypeValues() []UserType { + return []UserType{UserTypeGroup, UserTypeUser} +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/models.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/models.go new file mode 100644 index 000000000000..25ad92679c2d --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/models.go @@ -0,0 +1,6370 @@ +package authorization + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/authorization/mgmt/2020-10-01-preview/authorization" + +// AccessReviewActorIdentity details of the actor identity +type AccessReviewActorIdentity struct { + // PrincipalID - READ-ONLY; The identity id + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - READ-ONLY; The identity type : user/servicePrincipal. Possible values include: 'User', 'ServicePrincipal' + PrincipalType AccessReviewActorIdentityType `json:"principalType,omitempty"` + // PrincipalName - READ-ONLY; The identity display name + PrincipalName *string `json:"principalName,omitempty"` + // UserPrincipalName - READ-ONLY; The user principal name(if valid) + UserPrincipalName *string `json:"userPrincipalName,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewActorIdentity. +func (arai AccessReviewActorIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// AccessReviewDecision access Review. +type AccessReviewDecision struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The access review decision id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The access review decision name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // AccessReviewDecisionProperties - Access Review Decision properties. + *AccessReviewDecisionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewDecision. +func (ard AccessReviewDecision) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ard.AccessReviewDecisionProperties != nil { + objectMap["properties"] = ard.AccessReviewDecisionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewDecision struct. +func (ard *AccessReviewDecision) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ard.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ard.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ard.Type = &typeVar + } + case "properties": + if v != nil { + var accessReviewDecisionProperties AccessReviewDecisionProperties + err = json.Unmarshal(*v, &accessReviewDecisionProperties) + if err != nil { + return err + } + ard.AccessReviewDecisionProperties = &accessReviewDecisionProperties + } + } + } + + return nil +} + +// AccessReviewDecisionListResult list of access review decisions. +type AccessReviewDecisionListResult struct { + autorest.Response `json:"-"` + // Value - Access Review Decision list. + Value *[]AccessReviewDecision `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AccessReviewDecisionListResultIterator provides access to a complete listing of AccessReviewDecision +// values. +type AccessReviewDecisionListResultIterator struct { + i int + page AccessReviewDecisionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccessReviewDecisionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewDecisionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccessReviewDecisionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccessReviewDecisionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccessReviewDecisionListResultIterator) Response() AccessReviewDecisionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccessReviewDecisionListResultIterator) Value() AccessReviewDecision { + if !iter.page.NotDone() { + return AccessReviewDecision{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccessReviewDecisionListResultIterator type. +func NewAccessReviewDecisionListResultIterator(page AccessReviewDecisionListResultPage) AccessReviewDecisionListResultIterator { + return AccessReviewDecisionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ardlr AccessReviewDecisionListResult) IsEmpty() bool { + return ardlr.Value == nil || len(*ardlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ardlr AccessReviewDecisionListResult) hasNextLink() bool { + return ardlr.NextLink != nil && len(*ardlr.NextLink) != 0 +} + +// accessReviewDecisionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ardlr AccessReviewDecisionListResult) accessReviewDecisionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ardlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ardlr.NextLink))) +} + +// AccessReviewDecisionListResultPage contains a page of AccessReviewDecision values. +type AccessReviewDecisionListResultPage struct { + fn func(context.Context, AccessReviewDecisionListResult) (AccessReviewDecisionListResult, error) + ardlr AccessReviewDecisionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccessReviewDecisionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewDecisionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ardlr) + if err != nil { + return err + } + page.ardlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccessReviewDecisionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccessReviewDecisionListResultPage) NotDone() bool { + return !page.ardlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccessReviewDecisionListResultPage) Response() AccessReviewDecisionListResult { + return page.ardlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccessReviewDecisionListResultPage) Values() []AccessReviewDecision { + if page.ardlr.IsEmpty() { + return nil + } + return *page.ardlr.Value +} + +// Creates a new instance of the AccessReviewDecisionListResultPage type. +func NewAccessReviewDecisionListResultPage(cur AccessReviewDecisionListResult, getNextPage func(context.Context, AccessReviewDecisionListResult) (AccessReviewDecisionListResult, error)) AccessReviewDecisionListResultPage { + return AccessReviewDecisionListResultPage{ + fn: getNextPage, + ardlr: cur, + } +} + +// AccessReviewDecisionProperties approval Step. +type AccessReviewDecisionProperties struct { + // BasicAccessReviewDecisionTarget - READ-ONLY; Target of this decision record. Can be UserDecisionTarget or ServicePrincipalDecisionTarget + BasicAccessReviewDecisionTarget `json:"target,omitempty"` + // Recommendation - READ-ONLY; The feature- generated recommendation shown to the reviewer. Possible values include: 'Approve', 'Deny', 'NoInfoAvailable' + Recommendation AccessRecommendationType `json:"recommendation,omitempty"` + // Decision - The decision on the approval step. This value is initially set to NotReviewed. Approvers can take action of Approve/Deny. Possible values include: 'AccessReviewResultApprove', 'AccessReviewResultDeny', 'AccessReviewResultNotReviewed', 'AccessReviewResultDontKnow', 'AccessReviewResultNotNotified' + Decision AccessReviewResult `json:"decision,omitempty"` + // Justification - Justification provided by approvers for their action + Justification *string `json:"justification,omitempty"` + // ReviewedDateTime - READ-ONLY; Date Time when a decision was taken. + ReviewedDateTime *date.Time `json:"reviewedDateTime,omitempty"` + // AccessReviewActorIdentity - READ-ONLY; Details of the approver. + *AccessReviewActorIdentity `json:"reviewedBy,omitempty"` + // ApplyResult - READ-ONLY; The outcome of applying the decision. Possible values include: 'AccessReviewApplyResultNew', 'AccessReviewApplyResultApplying', 'AccessReviewApplyResultAppliedSuccessfully', 'AccessReviewApplyResultAppliedWithUnknownFailure', 'AccessReviewApplyResultAppliedSuccessfullyButObjectNotFound', 'AccessReviewApplyResultApplyNotSupported' + ApplyResult AccessReviewApplyResult `json:"applyResult,omitempty"` + // AppliedDateTime - READ-ONLY; The date and time when the review decision was applied. + AppliedDateTime *date.Time `json:"appliedDateTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewDecisionProperties. +func (ardp AccessReviewDecisionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ardp.Decision != "" { + objectMap["decision"] = ardp.Decision + } + if ardp.Justification != nil { + objectMap["justification"] = ardp.Justification + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewDecisionProperties struct. +func (ardp *AccessReviewDecisionProperties) 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 "target": + if v != nil { + basicAccessReviewDecisionTarget, err := unmarshalBasicAccessReviewDecisionTarget(*v) + if err != nil { + return err + } + ardp.BasicAccessReviewDecisionTarget = basicAccessReviewDecisionTarget + } + case "recommendation": + if v != nil { + var recommendation AccessRecommendationType + err = json.Unmarshal(*v, &recommendation) + if err != nil { + return err + } + ardp.Recommendation = recommendation + } + case "decision": + if v != nil { + var decision AccessReviewResult + err = json.Unmarshal(*v, &decision) + if err != nil { + return err + } + ardp.Decision = decision + } + case "justification": + if v != nil { + var justification string + err = json.Unmarshal(*v, &justification) + if err != nil { + return err + } + ardp.Justification = &justification + } + case "reviewedDateTime": + if v != nil { + var reviewedDateTime date.Time + err = json.Unmarshal(*v, &reviewedDateTime) + if err != nil { + return err + } + ardp.ReviewedDateTime = &reviewedDateTime + } + case "reviewedBy": + if v != nil { + var accessReviewActorIdentity AccessReviewActorIdentity + err = json.Unmarshal(*v, &accessReviewActorIdentity) + if err != nil { + return err + } + ardp.AccessReviewActorIdentity = &accessReviewActorIdentity + } + case "applyResult": + if v != nil { + var applyResult AccessReviewApplyResult + err = json.Unmarshal(*v, &applyResult) + if err != nil { + return err + } + ardp.ApplyResult = applyResult + } + case "appliedDateTime": + if v != nil { + var appliedDateTime date.Time + err = json.Unmarshal(*v, &appliedDateTime) + if err != nil { + return err + } + ardp.AppliedDateTime = &appliedDateTime + } + case "appliedBy": + if v != nil { + var accessReviewActorIdentity1 AccessReviewActorIdentity + err = json.Unmarshal(*v, &accessReviewActorIdentity1) + if err != nil { + return err + } + ardp.AccessReviewActorIdentity = &accessReviewActorIdentity1 + } + } + } + + return nil +} + +// BasicAccessReviewDecisionTarget target of the decision. +type BasicAccessReviewDecisionTarget interface { + AsUserDecisionTarget() (*UserDecisionTarget, bool) + AsServicePrincipalDecisionTarget() (*ServicePrincipalDecisionTarget, bool) + AsAccessReviewDecisionTarget() (*AccessReviewDecisionTarget, bool) +} + +// AccessReviewDecisionTarget target of the decision. +type AccessReviewDecisionTarget struct { + // Type - Possible values include: 'TypeAccessReviewDecisionTarget', 'TypeUser', 'TypeServicePrincipal' + Type TypeBasicAccessReviewDecisionTarget `json:"type,omitempty"` +} + +func unmarshalBasicAccessReviewDecisionTarget(body []byte) (BasicAccessReviewDecisionTarget, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["type"] { + case string(TypeUser): + var udt UserDecisionTarget + err := json.Unmarshal(body, &udt) + return udt, err + case string(TypeServicePrincipal): + var spdt ServicePrincipalDecisionTarget + err := json.Unmarshal(body, &spdt) + return spdt, err + default: + var ardt AccessReviewDecisionTarget + err := json.Unmarshal(body, &ardt) + return ardt, err + } +} +func unmarshalBasicAccessReviewDecisionTargetArray(body []byte) ([]BasicAccessReviewDecisionTarget, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + ardtArray := make([]BasicAccessReviewDecisionTarget, len(rawMessages)) + + for index, rawMessage := range rawMessages { + ardt, err := unmarshalBasicAccessReviewDecisionTarget(*rawMessage) + if err != nil { + return nil, err + } + ardtArray[index] = ardt + } + return ardtArray, nil +} + +// MarshalJSON is the custom marshaler for AccessReviewDecisionTarget. +func (ardt AccessReviewDecisionTarget) MarshalJSON() ([]byte, error) { + ardt.Type = TypeAccessReviewDecisionTarget + objectMap := make(map[string]interface{}) + if ardt.Type != "" { + objectMap["type"] = ardt.Type + } + return json.Marshal(objectMap) +} + +// AsUserDecisionTarget is the BasicAccessReviewDecisionTarget implementation for AccessReviewDecisionTarget. +func (ardt AccessReviewDecisionTarget) AsUserDecisionTarget() (*UserDecisionTarget, bool) { + return nil, false +} + +// AsServicePrincipalDecisionTarget is the BasicAccessReviewDecisionTarget implementation for AccessReviewDecisionTarget. +func (ardt AccessReviewDecisionTarget) AsServicePrincipalDecisionTarget() (*ServicePrincipalDecisionTarget, bool) { + return nil, false +} + +// AsAccessReviewDecisionTarget is the BasicAccessReviewDecisionTarget implementation for AccessReviewDecisionTarget. +func (ardt AccessReviewDecisionTarget) AsAccessReviewDecisionTarget() (*AccessReviewDecisionTarget, bool) { + return &ardt, true +} + +// AsBasicAccessReviewDecisionTarget is the BasicAccessReviewDecisionTarget implementation for AccessReviewDecisionTarget. +func (ardt AccessReviewDecisionTarget) AsBasicAccessReviewDecisionTarget() (BasicAccessReviewDecisionTarget, bool) { + return &ardt, true +} + +// AccessReviewDefaultSettings access Review Default Settings. +type AccessReviewDefaultSettings struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The access review default settings id. This is only going to be default + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The access review default settings name. This is always going to be Access Review Default Settings + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // AccessReviewScheduleSettings - Access Review properties. + *AccessReviewScheduleSettings `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewDefaultSettings. +func (ards AccessReviewDefaultSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ards.AccessReviewScheduleSettings != nil { + objectMap["properties"] = ards.AccessReviewScheduleSettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewDefaultSettings struct. +func (ards *AccessReviewDefaultSettings) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ards.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ards.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ards.Type = &typeVar + } + case "properties": + if v != nil { + var accessReviewScheduleSettings AccessReviewScheduleSettings + err = json.Unmarshal(*v, &accessReviewScheduleSettings) + if err != nil { + return err + } + ards.AccessReviewScheduleSettings = &accessReviewScheduleSettings + } + } + } + + return nil +} + +// AccessReviewInstance access Review Instance. +type AccessReviewInstance struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The access review instance id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The access review instance name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // AccessReviewInstanceProperties - Access Review properties. + *AccessReviewInstanceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewInstance. +func (ari AccessReviewInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ari.AccessReviewInstanceProperties != nil { + objectMap["properties"] = ari.AccessReviewInstanceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewInstance struct. +func (ari *AccessReviewInstance) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ari.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ari.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ari.Type = &typeVar + } + case "properties": + if v != nil { + var accessReviewInstanceProperties AccessReviewInstanceProperties + err = json.Unmarshal(*v, &accessReviewInstanceProperties) + if err != nil { + return err + } + ari.AccessReviewInstanceProperties = &accessReviewInstanceProperties + } + } + } + + return nil +} + +// AccessReviewInstanceListResult list of Access Review Instances. +type AccessReviewInstanceListResult struct { + autorest.Response `json:"-"` + // Value - Access Review Instance list. + Value *[]AccessReviewInstance `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AccessReviewInstanceListResultIterator provides access to a complete listing of AccessReviewInstance +// values. +type AccessReviewInstanceListResultIterator struct { + i int + page AccessReviewInstanceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccessReviewInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccessReviewInstanceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccessReviewInstanceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccessReviewInstanceListResultIterator) Response() AccessReviewInstanceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccessReviewInstanceListResultIterator) Value() AccessReviewInstance { + if !iter.page.NotDone() { + return AccessReviewInstance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccessReviewInstanceListResultIterator type. +func NewAccessReviewInstanceListResultIterator(page AccessReviewInstanceListResultPage) AccessReviewInstanceListResultIterator { + return AccessReviewInstanceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arilr AccessReviewInstanceListResult) IsEmpty() bool { + return arilr.Value == nil || len(*arilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arilr AccessReviewInstanceListResult) hasNextLink() bool { + return arilr.NextLink != nil && len(*arilr.NextLink) != 0 +} + +// accessReviewInstanceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arilr AccessReviewInstanceListResult) accessReviewInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !arilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arilr.NextLink))) +} + +// AccessReviewInstanceListResultPage contains a page of AccessReviewInstance values. +type AccessReviewInstanceListResultPage struct { + fn func(context.Context, AccessReviewInstanceListResult) (AccessReviewInstanceListResult, error) + arilr AccessReviewInstanceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccessReviewInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewInstanceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arilr) + if err != nil { + return err + } + page.arilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccessReviewInstanceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccessReviewInstanceListResultPage) NotDone() bool { + return !page.arilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccessReviewInstanceListResultPage) Response() AccessReviewInstanceListResult { + return page.arilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccessReviewInstanceListResultPage) Values() []AccessReviewInstance { + if page.arilr.IsEmpty() { + return nil + } + return *page.arilr.Value +} + +// Creates a new instance of the AccessReviewInstanceListResultPage type. +func NewAccessReviewInstanceListResultPage(cur AccessReviewInstanceListResult, getNextPage func(context.Context, AccessReviewInstanceListResult) (AccessReviewInstanceListResult, error)) AccessReviewInstanceListResultPage { + return AccessReviewInstanceListResultPage{ + fn: getNextPage, + arilr: cur, + } +} + +// AccessReviewInstanceProperties access Review Instance properties. +type AccessReviewInstanceProperties struct { + // Status - READ-ONLY; This read-only field specifies the status of an access review instance. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'Applied', 'Initializing', 'Applying', 'Completing', 'Scheduled', 'AutoReviewing', 'AutoReviewed', 'Starting' + Status AccessReviewInstanceStatus `json:"status,omitempty"` + // StartDateTime - The DateTime when the review instance is scheduled to be start. + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // EndDateTime - The DateTime when the review instance is scheduled to end. + EndDateTime *date.Time `json:"endDateTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewInstanceProperties. +func (arip AccessReviewInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arip.StartDateTime != nil { + objectMap["startDateTime"] = arip.StartDateTime + } + if arip.EndDateTime != nil { + objectMap["endDateTime"] = arip.EndDateTime + } + return json.Marshal(objectMap) +} + +// AccessReviewRecurrencePattern recurrence Pattern of an Access Review Schedule Definition. +type AccessReviewRecurrencePattern struct { + // Type - The recurrence type : weekly, monthly, etc. Possible values include: 'Weekly', 'AbsoluteMonthly' + Type AccessReviewRecurrencePatternType `json:"type,omitempty"` + // Interval - The interval for recurrence. For a quarterly review, the interval is 3 for type : absoluteMonthly. + Interval *int32 `json:"interval,omitempty"` +} + +// AccessReviewRecurrenceRange recurrence Range of an Access Review Schedule Definition. +type AccessReviewRecurrenceRange struct { + // Type - The recurrence range type. The possible values are: endDate, noEnd, numbered. Possible values include: 'EndDate', 'NoEnd', 'Numbered' + Type AccessReviewRecurrenceRangeType `json:"type,omitempty"` + // NumberOfOccurrences - The number of times to repeat the access review. Required and must be positive if type is numbered. + NumberOfOccurrences *int32 `json:"numberOfOccurrences,omitempty"` + // StartDate - The DateTime when the review is scheduled to be start. This could be a date in the future. Required on create. + StartDate *date.Time `json:"startDate,omitempty"` + // EndDate - The DateTime when the review is scheduled to end. Required if type is endDate + EndDate *date.Time `json:"endDate,omitempty"` +} + +// AccessReviewRecurrenceSettings recurrence Settings of an Access Review Schedule Definition. +type AccessReviewRecurrenceSettings struct { + // AccessReviewRecurrencePattern - Access Review schedule definition recurrence pattern. + *AccessReviewRecurrencePattern `json:"pattern,omitempty"` + // AccessReviewRecurrenceRange - Access Review schedule definition recurrence range. + *AccessReviewRecurrenceRange `json:"range,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewRecurrenceSettings. +func (arrs AccessReviewRecurrenceSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arrs.AccessReviewRecurrencePattern != nil { + objectMap["pattern"] = arrs.AccessReviewRecurrencePattern + } + if arrs.AccessReviewRecurrenceRange != nil { + objectMap["range"] = arrs.AccessReviewRecurrenceRange + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewRecurrenceSettings struct. +func (arrs *AccessReviewRecurrenceSettings) 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 "pattern": + if v != nil { + var accessReviewRecurrencePattern AccessReviewRecurrencePattern + err = json.Unmarshal(*v, &accessReviewRecurrencePattern) + if err != nil { + return err + } + arrs.AccessReviewRecurrencePattern = &accessReviewRecurrencePattern + } + case "range": + if v != nil { + var accessReviewRecurrenceRange AccessReviewRecurrenceRange + err = json.Unmarshal(*v, &accessReviewRecurrenceRange) + if err != nil { + return err + } + arrs.AccessReviewRecurrenceRange = &accessReviewRecurrenceRange + } + } + } + + return nil +} + +// AccessReviewReviewer descriptor for what needs to be reviewed +type AccessReviewReviewer struct { + // PrincipalID - The id of the reviewer(user/servicePrincipal) + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - READ-ONLY; The identity type : user/servicePrincipal. Possible values include: 'AccessReviewReviewerTypeUser', 'AccessReviewReviewerTypeServicePrincipal' + PrincipalType AccessReviewReviewerType `json:"principalType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewReviewer. +func (arr AccessReviewReviewer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arr.PrincipalID != nil { + objectMap["principalId"] = arr.PrincipalID + } + return json.Marshal(objectMap) +} + +// AccessReviewScheduleDefinition access Review Schedule Definition. +type AccessReviewScheduleDefinition struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The access review schedule definition id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The access review schedule definition unique id. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // AccessReviewScheduleDefinitionProperties - Access Review properties. + *AccessReviewScheduleDefinitionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewScheduleDefinition. +func (arsd AccessReviewScheduleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arsd.AccessReviewScheduleDefinitionProperties != nil { + objectMap["properties"] = arsd.AccessReviewScheduleDefinitionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewScheduleDefinition struct. +func (arsd *AccessReviewScheduleDefinition) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + arsd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + arsd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + arsd.Type = &typeVar + } + case "properties": + if v != nil { + var accessReviewScheduleDefinitionProperties AccessReviewScheduleDefinitionProperties + err = json.Unmarshal(*v, &accessReviewScheduleDefinitionProperties) + if err != nil { + return err + } + arsd.AccessReviewScheduleDefinitionProperties = &accessReviewScheduleDefinitionProperties + } + } + } + + return nil +} + +// AccessReviewScheduleDefinitionListResult list of Access Review Schedule Definitions. +type AccessReviewScheduleDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - Access Review Schedule Definition list. + Value *[]AccessReviewScheduleDefinition `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AccessReviewScheduleDefinitionListResultIterator provides access to a complete listing of +// AccessReviewScheduleDefinition values. +type AccessReviewScheduleDefinitionListResultIterator struct { + i int + page AccessReviewScheduleDefinitionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AccessReviewScheduleDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AccessReviewScheduleDefinitionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AccessReviewScheduleDefinitionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AccessReviewScheduleDefinitionListResultIterator) Response() AccessReviewScheduleDefinitionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AccessReviewScheduleDefinitionListResultIterator) Value() AccessReviewScheduleDefinition { + if !iter.page.NotDone() { + return AccessReviewScheduleDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AccessReviewScheduleDefinitionListResultIterator type. +func NewAccessReviewScheduleDefinitionListResultIterator(page AccessReviewScheduleDefinitionListResultPage) AccessReviewScheduleDefinitionListResultIterator { + return AccessReviewScheduleDefinitionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arsdlr AccessReviewScheduleDefinitionListResult) IsEmpty() bool { + return arsdlr.Value == nil || len(*arsdlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arsdlr AccessReviewScheduleDefinitionListResult) hasNextLink() bool { + return arsdlr.NextLink != nil && len(*arsdlr.NextLink) != 0 +} + +// accessReviewScheduleDefinitionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arsdlr AccessReviewScheduleDefinitionListResult) accessReviewScheduleDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !arsdlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arsdlr.NextLink))) +} + +// AccessReviewScheduleDefinitionListResultPage contains a page of AccessReviewScheduleDefinition values. +type AccessReviewScheduleDefinitionListResultPage struct { + fn func(context.Context, AccessReviewScheduleDefinitionListResult) (AccessReviewScheduleDefinitionListResult, error) + arsdlr AccessReviewScheduleDefinitionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AccessReviewScheduleDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AccessReviewScheduleDefinitionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.arsdlr) + if err != nil { + return err + } + page.arsdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AccessReviewScheduleDefinitionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AccessReviewScheduleDefinitionListResultPage) NotDone() bool { + return !page.arsdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AccessReviewScheduleDefinitionListResultPage) Response() AccessReviewScheduleDefinitionListResult { + return page.arsdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AccessReviewScheduleDefinitionListResultPage) Values() []AccessReviewScheduleDefinition { + if page.arsdlr.IsEmpty() { + return nil + } + return *page.arsdlr.Value +} + +// Creates a new instance of the AccessReviewScheduleDefinitionListResultPage type. +func NewAccessReviewScheduleDefinitionListResultPage(cur AccessReviewScheduleDefinitionListResult, getNextPage func(context.Context, AccessReviewScheduleDefinitionListResult) (AccessReviewScheduleDefinitionListResult, error)) AccessReviewScheduleDefinitionListResultPage { + return AccessReviewScheduleDefinitionListResultPage{ + fn: getNextPage, + arsdlr: cur, + } +} + +// AccessReviewScheduleDefinitionProperties access Review. +type AccessReviewScheduleDefinitionProperties struct { + // DisplayName - The display name for the schedule definition. + DisplayName *string `json:"displayName,omitempty"` + // Status - READ-ONLY; This read-only field specifies the status of an accessReview. Possible values include: 'AccessReviewScheduleDefinitionStatusNotStarted', 'AccessReviewScheduleDefinitionStatusInProgress', 'AccessReviewScheduleDefinitionStatusCompleted', 'AccessReviewScheduleDefinitionStatusApplied', 'AccessReviewScheduleDefinitionStatusInitializing', 'AccessReviewScheduleDefinitionStatusApplying', 'AccessReviewScheduleDefinitionStatusCompleting', 'AccessReviewScheduleDefinitionStatusScheduled', 'AccessReviewScheduleDefinitionStatusAutoReviewing', 'AccessReviewScheduleDefinitionStatusAutoReviewed', 'AccessReviewScheduleDefinitionStatusStarting' + Status AccessReviewScheduleDefinitionStatus `json:"status,omitempty"` + // DescriptionForAdmins - The description provided by the access review creator and visible to admins. + DescriptionForAdmins *string `json:"descriptionForAdmins,omitempty"` + // DescriptionForReviewers - The description provided by the access review creator to be shown to reviewers. + DescriptionForReviewers *string `json:"descriptionForReviewers,omitempty"` + // AccessReviewActorIdentity - READ-ONLY; The user or other identity who created this review. + *AccessReviewActorIdentity `json:"createdBy,omitempty"` + // AccessReviewScheduleSettings - Access Review Settings. + *AccessReviewScheduleSettings `json:"settings,omitempty"` + // AccessReviewScope - READ-ONLY; This is used to define what to include in scope of the review. The scope definition includes the resourceId and roleDefinitionId. + *AccessReviewScope `json:"scope,omitempty"` + // Reviewers - This is the collection of reviewers. + Reviewers *[]AccessReviewReviewer `json:"reviewers,omitempty"` + // ReviewersType - READ-ONLY; This field specifies the type of reviewers for a review. Usually for a review, reviewers are explicitly assigned. However, in some cases, the reviewers may not be assigned and instead be chosen dynamically. For example managers review or self review. Possible values include: 'Assigned', 'Self', 'Managers' + ReviewersType AccessReviewScheduleDefinitionReviewersType `json:"reviewersType,omitempty"` + // Instances - This is the collection of instances returned when one does an expand on it. + Instances *[]AccessReviewInstance `json:"instances,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewScheduleDefinitionProperties. +func (arsdp AccessReviewScheduleDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arsdp.DisplayName != nil { + objectMap["displayName"] = arsdp.DisplayName + } + if arsdp.DescriptionForAdmins != nil { + objectMap["descriptionForAdmins"] = arsdp.DescriptionForAdmins + } + if arsdp.DescriptionForReviewers != nil { + objectMap["descriptionForReviewers"] = arsdp.DescriptionForReviewers + } + if arsdp.AccessReviewScheduleSettings != nil { + objectMap["settings"] = arsdp.AccessReviewScheduleSettings + } + if arsdp.Reviewers != nil { + objectMap["reviewers"] = arsdp.Reviewers + } + if arsdp.Instances != nil { + objectMap["instances"] = arsdp.Instances + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewScheduleDefinitionProperties struct. +func (arsdp *AccessReviewScheduleDefinitionProperties) 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 "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + arsdp.DisplayName = &displayName + } + case "status": + if v != nil { + var status AccessReviewScheduleDefinitionStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + arsdp.Status = status + } + case "descriptionForAdmins": + if v != nil { + var descriptionForAdmins string + err = json.Unmarshal(*v, &descriptionForAdmins) + if err != nil { + return err + } + arsdp.DescriptionForAdmins = &descriptionForAdmins + } + case "descriptionForReviewers": + if v != nil { + var descriptionForReviewers string + err = json.Unmarshal(*v, &descriptionForReviewers) + if err != nil { + return err + } + arsdp.DescriptionForReviewers = &descriptionForReviewers + } + case "createdBy": + if v != nil { + var accessReviewActorIdentity AccessReviewActorIdentity + err = json.Unmarshal(*v, &accessReviewActorIdentity) + if err != nil { + return err + } + arsdp.AccessReviewActorIdentity = &accessReviewActorIdentity + } + case "settings": + if v != nil { + var accessReviewScheduleSettings AccessReviewScheduleSettings + err = json.Unmarshal(*v, &accessReviewScheduleSettings) + if err != nil { + return err + } + arsdp.AccessReviewScheduleSettings = &accessReviewScheduleSettings + } + case "scope": + if v != nil { + var accessReviewScope AccessReviewScope + err = json.Unmarshal(*v, &accessReviewScope) + if err != nil { + return err + } + arsdp.AccessReviewScope = &accessReviewScope + } + case "reviewers": + if v != nil { + var reviewers []AccessReviewReviewer + err = json.Unmarshal(*v, &reviewers) + if err != nil { + return err + } + arsdp.Reviewers = &reviewers + } + case "reviewersType": + if v != nil { + var reviewersType AccessReviewScheduleDefinitionReviewersType + err = json.Unmarshal(*v, &reviewersType) + if err != nil { + return err + } + arsdp.ReviewersType = reviewersType + } + case "instances": + if v != nil { + var instances []AccessReviewInstance + err = json.Unmarshal(*v, &instances) + if err != nil { + return err + } + arsdp.Instances = &instances + } + } + } + + return nil +} + +// AccessReviewScheduleSettings settings of an Access Review. +type AccessReviewScheduleSettings struct { + // MailNotificationsEnabled - Flag to indicate whether sending mails to reviewers and the review creator is enabled. + MailNotificationsEnabled *bool `json:"mailNotificationsEnabled,omitempty"` + // ReminderNotificationsEnabled - Flag to indicate whether sending reminder emails to reviewers are enabled. + ReminderNotificationsEnabled *bool `json:"reminderNotificationsEnabled,omitempty"` + // DefaultDecisionEnabled - Flag to indicate whether reviewers are required to provide a justification when reviewing access. + DefaultDecisionEnabled *bool `json:"defaultDecisionEnabled,omitempty"` + // JustificationRequiredOnApproval - Flag to indicate whether the reviewer is required to pass justification when recording a decision. + JustificationRequiredOnApproval *bool `json:"justificationRequiredOnApproval,omitempty"` + // DefaultDecision - This specifies the behavior for the autoReview feature when an access review completes. Possible values include: 'DefaultDecisionTypeApprove', 'DefaultDecisionTypeDeny', 'DefaultDecisionTypeRecommendation' + DefaultDecision DefaultDecisionType `json:"defaultDecision,omitempty"` + // AutoApplyDecisionsEnabled - Flag to indicate whether auto-apply capability, to automatically change the target object access resource, is enabled. If not enabled, a user must, after the review completes, apply the access review. + AutoApplyDecisionsEnabled *bool `json:"autoApplyDecisionsEnabled,omitempty"` + // RecommendationsEnabled - Flag to indicate whether showing recommendations to reviewers is enabled. + RecommendationsEnabled *bool `json:"recommendationsEnabled,omitempty"` + // InstanceDurationInDays - The duration in days for an instance. + InstanceDurationInDays *int32 `json:"instanceDurationInDays,omitempty"` + // AccessReviewRecurrenceSettings - Access Review Settings. + *AccessReviewRecurrenceSettings `json:"recurrence,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewScheduleSettings. +func (arss AccessReviewScheduleSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if arss.MailNotificationsEnabled != nil { + objectMap["mailNotificationsEnabled"] = arss.MailNotificationsEnabled + } + if arss.ReminderNotificationsEnabled != nil { + objectMap["reminderNotificationsEnabled"] = arss.ReminderNotificationsEnabled + } + if arss.DefaultDecisionEnabled != nil { + objectMap["defaultDecisionEnabled"] = arss.DefaultDecisionEnabled + } + if arss.JustificationRequiredOnApproval != nil { + objectMap["justificationRequiredOnApproval"] = arss.JustificationRequiredOnApproval + } + if arss.DefaultDecision != "" { + objectMap["defaultDecision"] = arss.DefaultDecision + } + if arss.AutoApplyDecisionsEnabled != nil { + objectMap["autoApplyDecisionsEnabled"] = arss.AutoApplyDecisionsEnabled + } + if arss.RecommendationsEnabled != nil { + objectMap["recommendationsEnabled"] = arss.RecommendationsEnabled + } + if arss.InstanceDurationInDays != nil { + objectMap["instanceDurationInDays"] = arss.InstanceDurationInDays + } + if arss.AccessReviewRecurrenceSettings != nil { + objectMap["recurrence"] = arss.AccessReviewRecurrenceSettings + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for AccessReviewScheduleSettings struct. +func (arss *AccessReviewScheduleSettings) 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 "mailNotificationsEnabled": + if v != nil { + var mailNotificationsEnabled bool + err = json.Unmarshal(*v, &mailNotificationsEnabled) + if err != nil { + return err + } + arss.MailNotificationsEnabled = &mailNotificationsEnabled + } + case "reminderNotificationsEnabled": + if v != nil { + var reminderNotificationsEnabled bool + err = json.Unmarshal(*v, &reminderNotificationsEnabled) + if err != nil { + return err + } + arss.ReminderNotificationsEnabled = &reminderNotificationsEnabled + } + case "defaultDecisionEnabled": + if v != nil { + var defaultDecisionEnabled bool + err = json.Unmarshal(*v, &defaultDecisionEnabled) + if err != nil { + return err + } + arss.DefaultDecisionEnabled = &defaultDecisionEnabled + } + case "justificationRequiredOnApproval": + if v != nil { + var justificationRequiredOnApproval bool + err = json.Unmarshal(*v, &justificationRequiredOnApproval) + if err != nil { + return err + } + arss.JustificationRequiredOnApproval = &justificationRequiredOnApproval + } + case "defaultDecision": + if v != nil { + var defaultDecision DefaultDecisionType + err = json.Unmarshal(*v, &defaultDecision) + if err != nil { + return err + } + arss.DefaultDecision = defaultDecision + } + case "autoApplyDecisionsEnabled": + if v != nil { + var autoApplyDecisionsEnabled bool + err = json.Unmarshal(*v, &autoApplyDecisionsEnabled) + if err != nil { + return err + } + arss.AutoApplyDecisionsEnabled = &autoApplyDecisionsEnabled + } + case "recommendationsEnabled": + if v != nil { + var recommendationsEnabled bool + err = json.Unmarshal(*v, &recommendationsEnabled) + if err != nil { + return err + } + arss.RecommendationsEnabled = &recommendationsEnabled + } + case "instanceDurationInDays": + if v != nil { + var instanceDurationInDays int32 + err = json.Unmarshal(*v, &instanceDurationInDays) + if err != nil { + return err + } + arss.InstanceDurationInDays = &instanceDurationInDays + } + case "recurrence": + if v != nil { + var accessReviewRecurrenceSettings AccessReviewRecurrenceSettings + err = json.Unmarshal(*v, &accessReviewRecurrenceSettings) + if err != nil { + return err + } + arss.AccessReviewRecurrenceSettings = &accessReviewRecurrenceSettings + } + } + } + + return nil +} + +// AccessReviewScope descriptor for what needs to be reviewed +type AccessReviewScope struct { + // ResourceID - READ-ONLY; ResourceId in which this review is getting created + ResourceID *string `json:"resourceId,omitempty"` + // RoleDefinitionID - READ-ONLY; This is used to indicate the role being reviewed + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalType - READ-ONLY; The identity type user/servicePrincipal to review. Possible values include: 'AccessReviewScopePrincipalTypeUser', 'AccessReviewScopePrincipalTypeServicePrincipal' + PrincipalType AccessReviewScopePrincipalType `json:"principalType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AccessReviewScope. +func (ars AccessReviewScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ApprovalSettings the approval settings. +type ApprovalSettings struct { + // IsApprovalRequired - Determine whether approval is required or not. + IsApprovalRequired *bool `json:"isApprovalRequired,omitempty"` + // IsApprovalRequiredForExtension - Determine whether approval is required for assignment extension. + IsApprovalRequiredForExtension *bool `json:"isApprovalRequiredForExtension,omitempty"` + // IsRequestorJustificationRequired - Determine whether requestor justification required. + IsRequestorJustificationRequired *bool `json:"isRequestorJustificationRequired,omitempty"` + // ApprovalMode - The type of rule. Possible values include: 'SingleStage', 'Serial', 'Parallel', 'NoApproval' + ApprovalMode ApprovalMode `json:"approvalMode,omitempty"` + // ApprovalStages - The approval stages of the request. + ApprovalStages *[]ApprovalStage `json:"approvalStages,omitempty"` +} + +// ApprovalStage the approval stage. +type ApprovalStage struct { + // ApprovalStageTimeOutInDays - The time in days when approval request would be timed out. + ApprovalStageTimeOutInDays *int32 `json:"approvalStageTimeOutInDays,omitempty"` + // IsApproverJustificationRequired - Determine whether approver need to provide justification for his decision. + IsApproverJustificationRequired *bool `json:"isApproverJustificationRequired,omitempty"` + // EscalationTimeInMinutes - The time in minutes when the approval request would be escalated if the primary approver does not approves. + EscalationTimeInMinutes *int32 `json:"escalationTimeInMinutes,omitempty"` + // PrimaryApprovers - The primary approver of the request. + PrimaryApprovers *[]UserSet `json:"primaryApprovers,omitempty"` + // IsEscalationEnabled - The value determine whether escalation feature is enabled. + IsEscalationEnabled *bool `json:"isEscalationEnabled,omitempty"` + // EscalationApprovers - The escalation approver of the request. + EscalationApprovers *[]UserSet `json:"escalationApprovers,omitempty"` +} + +// CloudError an error response from the service. +type CloudError struct { + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` +} + +// DenyAssignment deny Assignment +type DenyAssignment struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The deny assignment ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The deny assignment name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The deny assignment type. + Type *string `json:"type,omitempty"` + // DenyAssignmentProperties - Deny assignment properties. + *DenyAssignmentProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DenyAssignment. +func (da DenyAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if da.DenyAssignmentProperties != nil { + objectMap["properties"] = da.DenyAssignmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DenyAssignment struct. +func (da *DenyAssignment) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + da.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + da.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + da.Type = &typeVar + } + case "properties": + if v != nil { + var denyAssignmentProperties DenyAssignmentProperties + err = json.Unmarshal(*v, &denyAssignmentProperties) + if err != nil { + return err + } + da.DenyAssignmentProperties = &denyAssignmentProperties + } + } + } + + return nil +} + +// DenyAssignmentFilter deny Assignments filter +type DenyAssignmentFilter struct { + // DenyAssignmentName - Return deny assignment with specified name. + DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` + // PrincipalID - Return all deny assignments where the specified principal is listed in the principals list of deny assignments. + PrincipalID *string `json:"principalId,omitempty"` + // GdprExportPrincipalID - Return all deny assignments where the specified principal is listed either in the principals list or exclude principals list of deny assignments. + GdprExportPrincipalID *string `json:"gdprExportPrincipalId,omitempty"` +} + +// DenyAssignmentListResult deny assignment list operation result. +type DenyAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - Deny assignment list. + Value *[]DenyAssignment `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DenyAssignmentListResultIterator provides access to a complete listing of DenyAssignment values. +type DenyAssignmentListResultIterator struct { + i int + page DenyAssignmentListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DenyAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DenyAssignmentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DenyAssignmentListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DenyAssignmentListResultIterator) Response() DenyAssignmentListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DenyAssignmentListResultIterator) Value() DenyAssignment { + if !iter.page.NotDone() { + return DenyAssignment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DenyAssignmentListResultIterator type. +func NewDenyAssignmentListResultIterator(page DenyAssignmentListResultPage) DenyAssignmentListResultIterator { + return DenyAssignmentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dalr DenyAssignmentListResult) IsEmpty() bool { + return dalr.Value == nil || len(*dalr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dalr DenyAssignmentListResult) hasNextLink() bool { + return dalr.NextLink != nil && len(*dalr.NextLink) != 0 +} + +// denyAssignmentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dalr DenyAssignmentListResult) denyAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dalr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dalr.NextLink))) +} + +// DenyAssignmentListResultPage contains a page of DenyAssignment values. +type DenyAssignmentListResultPage struct { + fn func(context.Context, DenyAssignmentListResult) (DenyAssignmentListResult, error) + dalr DenyAssignmentListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DenyAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DenyAssignmentListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dalr) + if err != nil { + return err + } + page.dalr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DenyAssignmentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DenyAssignmentListResultPage) NotDone() bool { + return !page.dalr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DenyAssignmentListResultPage) Response() DenyAssignmentListResult { + return page.dalr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DenyAssignmentListResultPage) Values() []DenyAssignment { + if page.dalr.IsEmpty() { + return nil + } + return *page.dalr.Value +} + +// Creates a new instance of the DenyAssignmentListResultPage type. +func NewDenyAssignmentListResultPage(cur DenyAssignmentListResult, getNextPage func(context.Context, DenyAssignmentListResult) (DenyAssignmentListResult, error)) DenyAssignmentListResultPage { + return DenyAssignmentListResultPage{ + fn: getNextPage, + dalr: cur, + } +} + +// DenyAssignmentPermission deny assignment permissions. +type DenyAssignmentPermission struct { + // Actions - Actions to which the deny assignment does not grant access. + Actions *[]string `json:"actions,omitempty"` + // NotActions - Actions to exclude from that the deny assignment does not grant access. + NotActions *[]string `json:"notActions,omitempty"` + // DataActions - Data actions to which the deny assignment does not grant access. + DataActions *[]string `json:"dataActions,omitempty"` + // NotDataActions - Data actions to exclude from that the deny assignment does not grant access. + NotDataActions *[]string `json:"notDataActions,omitempty"` +} + +// DenyAssignmentProperties deny assignment properties. +type DenyAssignmentProperties struct { + // DenyAssignmentName - The display name of the deny assignment. + DenyAssignmentName *string `json:"denyAssignmentName,omitempty"` + // Description - The description of the deny assignment. + Description *string `json:"description,omitempty"` + // Permissions - An array of permissions that are denied by the deny assignment. + Permissions *[]DenyAssignmentPermission `json:"permissions,omitempty"` + // Scope - The deny assignment scope. + Scope *string `json:"scope,omitempty"` + // DoNotApplyToChildScopes - Determines if the deny assignment applies to child scopes. Default value is false. + DoNotApplyToChildScopes *bool `json:"doNotApplyToChildScopes,omitempty"` + // Principals - Array of principals to which the deny assignment applies. + Principals *[]Principal `json:"principals,omitempty"` + // ExcludePrincipals - Array of principals to which the deny assignment does not apply. + ExcludePrincipals *[]Principal `json:"excludePrincipals,omitempty"` + // IsSystemProtected - Specifies whether this deny assignment was created by Azure and cannot be edited or deleted. + IsSystemProtected *bool `json:"isSystemProtected,omitempty"` +} + +// EligibleChildResource eligible child resource +type EligibleChildResource struct { + // ID - READ-ONLY; The resource scope Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for EligibleChildResource. +func (ecr EligibleChildResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// EligibleChildResourcesListResult eligible child resources list operation result. +type EligibleChildResourcesListResult struct { + autorest.Response `json:"-"` + // Value - Eligible child resource list. + Value *[]EligibleChildResource `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// EligibleChildResourcesListResultIterator provides access to a complete listing of EligibleChildResource +// values. +type EligibleChildResourcesListResultIterator struct { + i int + page EligibleChildResourcesListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EligibleChildResourcesListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EligibleChildResourcesListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EligibleChildResourcesListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EligibleChildResourcesListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EligibleChildResourcesListResultIterator) Response() EligibleChildResourcesListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EligibleChildResourcesListResultIterator) Value() EligibleChildResource { + if !iter.page.NotDone() { + return EligibleChildResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EligibleChildResourcesListResultIterator type. +func NewEligibleChildResourcesListResultIterator(page EligibleChildResourcesListResultPage) EligibleChildResourcesListResultIterator { + return EligibleChildResourcesListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ecrlr EligibleChildResourcesListResult) IsEmpty() bool { + return ecrlr.Value == nil || len(*ecrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ecrlr EligibleChildResourcesListResult) hasNextLink() bool { + return ecrlr.NextLink != nil && len(*ecrlr.NextLink) != 0 +} + +// eligibleChildResourcesListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ecrlr EligibleChildResourcesListResult) eligibleChildResourcesListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ecrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ecrlr.NextLink))) +} + +// EligibleChildResourcesListResultPage contains a page of EligibleChildResource values. +type EligibleChildResourcesListResultPage struct { + fn func(context.Context, EligibleChildResourcesListResult) (EligibleChildResourcesListResult, error) + ecrlr EligibleChildResourcesListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EligibleChildResourcesListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EligibleChildResourcesListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ecrlr) + if err != nil { + return err + } + page.ecrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EligibleChildResourcesListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EligibleChildResourcesListResultPage) NotDone() bool { + return !page.ecrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EligibleChildResourcesListResultPage) Response() EligibleChildResourcesListResult { + return page.ecrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EligibleChildResourcesListResultPage) Values() []EligibleChildResource { + if page.ecrlr.IsEmpty() { + return nil + } + return *page.ecrlr.Value +} + +// Creates a new instance of the EligibleChildResourcesListResultPage type. +func NewEligibleChildResourcesListResultPage(cur EligibleChildResourcesListResult, getNextPage func(context.Context, EligibleChildResourcesListResult) (EligibleChildResourcesListResult, error)) EligibleChildResourcesListResultPage { + return EligibleChildResourcesListResultPage{ + fn: getNextPage, + ecrlr: cur, + } +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDefinition error description and code explaining why an operation failed. +type ErrorDefinition struct { + // Error - Error of the list gateway status. + Error *ErrorDefinitionProperties `json:"error,omitempty"` +} + +// ErrorDefinitionProperties error description and code explaining why an operation failed. +type ErrorDefinitionProperties struct { + // Message - READ-ONLY; Description of the error. + Message *string `json:"message,omitempty"` + // Code - Error code of list gateway. + Code *string `json:"code,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDefinitionProperties. +func (edp ErrorDefinitionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if edp.Code != nil { + objectMap["code"] = edp.Code + } + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// ExpandedProperties ... +type ExpandedProperties struct { + // Scope - Details of the resource scope + Scope *ExpandedPropertiesScope `json:"scope,omitempty"` + // RoleDefinition - Details of role definition + RoleDefinition *ExpandedPropertiesRoleDefinition `json:"roleDefinition,omitempty"` + // Principal - Details of the principal + Principal *ExpandedPropertiesPrincipal `json:"principal,omitempty"` +} + +// ExpandedPropertiesPrincipal details of the principal +type ExpandedPropertiesPrincipal struct { + // ID - Id of the principal + ID *string `json:"id,omitempty"` + // DisplayName - Display name of the principal + DisplayName *string `json:"displayName,omitempty"` + // Email - Email id of the principal + Email *string `json:"email,omitempty"` + // Type - Type of the principal + Type *string `json:"type,omitempty"` +} + +// ExpandedPropertiesRoleDefinition details of role definition +type ExpandedPropertiesRoleDefinition struct { + // ID - Id of the role definition + ID *string `json:"id,omitempty"` + // DisplayName - Display name of the role definition + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of the role definition + Type *string `json:"type,omitempty"` +} + +// ExpandedPropertiesScope details of the resource scope +type ExpandedPropertiesScope struct { + // ID - Scope id of the resource + ID *string `json:"id,omitempty"` + // DisplayName - Display name of the resource + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// Operation the definition of a Microsoft.Authorization operation. +type Operation struct { + // Name - Name of the operation + Name *string `json:"name,omitempty"` + // IsDataAction - Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + // Display - Display of the operation + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// OperationDisplay the display information for a Microsoft.Authorization operation. +type OperationDisplay struct { + // Provider - READ-ONLY; The resource provider name: Microsoft.Authorization. + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; The resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; The operation that users can perform. + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; The description for the operation. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (od OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResult the result of a request to list Microsoft.Authorization operations. +type OperationListResult struct { + autorest.Response `json:"-"` + // Value - The collection value. + Value *[]Operation `json:"value,omitempty"` + // NextLink - The URI that can be used to request the next set of paged results. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// Permission role definition permissions. +type Permission struct { + // Actions - Allowed actions. + Actions *[]string `json:"actions,omitempty"` + // NotActions - Denied actions. + NotActions *[]string `json:"notActions,omitempty"` + // DataActions - Allowed Data actions. + DataActions *[]string `json:"dataActions,omitempty"` + // NotDataActions - Denied Data actions. + NotDataActions *[]string `json:"notDataActions,omitempty"` +} + +// PermissionGetResult permissions information. +type PermissionGetResult struct { + autorest.Response `json:"-"` + // Value - An array of permissions. + Value *[]Permission `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// PermissionGetResultIterator provides access to a complete listing of Permission values. +type PermissionGetResultIterator struct { + i int + page PermissionGetResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *PermissionGetResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionGetResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *PermissionGetResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter PermissionGetResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter PermissionGetResultIterator) Response() PermissionGetResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter PermissionGetResultIterator) Value() Permission { + if !iter.page.NotDone() { + return Permission{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the PermissionGetResultIterator type. +func NewPermissionGetResultIterator(page PermissionGetResultPage) PermissionGetResultIterator { + return PermissionGetResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pgr PermissionGetResult) IsEmpty() bool { + return pgr.Value == nil || len(*pgr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pgr PermissionGetResult) hasNextLink() bool { + return pgr.NextLink != nil && len(*pgr.NextLink) != 0 +} + +// permissionGetResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pgr PermissionGetResult) permissionGetResultPreparer(ctx context.Context) (*http.Request, error) { + if !pgr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pgr.NextLink))) +} + +// PermissionGetResultPage contains a page of Permission values. +type PermissionGetResultPage struct { + fn func(context.Context, PermissionGetResult) (PermissionGetResult, error) + pgr PermissionGetResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *PermissionGetResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionGetResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pgr) + if err != nil { + return err + } + page.pgr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *PermissionGetResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page PermissionGetResultPage) NotDone() bool { + return !page.pgr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page PermissionGetResultPage) Response() PermissionGetResult { + return page.pgr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page PermissionGetResultPage) Values() []Permission { + if page.pgr.IsEmpty() { + return nil + } + return *page.pgr.Value +} + +// Creates a new instance of the PermissionGetResultPage type. +func NewPermissionGetResultPage(cur PermissionGetResult, getNextPage func(context.Context, PermissionGetResult) (PermissionGetResult, error)) PermissionGetResultPage { + return PermissionGetResultPage{ + fn: getNextPage, + pgr: cur, + } +} + +// PolicyAssignmentProperties ... +type PolicyAssignmentProperties struct { + // Scope - Details of the resource scope + Scope *PolicyAssignmentPropertiesScope `json:"scope,omitempty"` + // RoleDefinition - Details of role definition + RoleDefinition *PolicyAssignmentPropertiesRoleDefinition `json:"roleDefinition,omitempty"` + // Policy - Details of the policy + Policy *PolicyAssignmentPropertiesPolicy `json:"policy,omitempty"` +} + +// PolicyAssignmentPropertiesPolicy details of the policy +type PolicyAssignmentPropertiesPolicy struct { + // ID - Id of the policy + ID *string `json:"id,omitempty"` + LastModifiedBy *Principal `json:"lastModifiedBy,omitempty"` + // LastModifiedDateTime - The last modified date time. + LastModifiedDateTime *date.Time `json:"lastModifiedDateTime,omitempty"` +} + +// PolicyAssignmentPropertiesRoleDefinition details of role definition +type PolicyAssignmentPropertiesRoleDefinition struct { + // ID - Id of the role definition + ID *string `json:"id,omitempty"` + // DisplayName - Display name of the role definition + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of the role definition + Type *string `json:"type,omitempty"` +} + +// PolicyAssignmentPropertiesScope details of the resource scope +type PolicyAssignmentPropertiesScope struct { + // ID - Scope id of the resource + ID *string `json:"id,omitempty"` + // DisplayName - Display name of the resource + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// PolicyProperties ... +type PolicyProperties struct { + // Scope - READ-ONLY; Details of the resource scope + Scope *PolicyPropertiesScope `json:"scope,omitempty"` +} + +// MarshalJSON is the custom marshaler for PolicyProperties. +func (pp PolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PolicyPropertiesScope details of the resource scope +type PolicyPropertiesScope struct { + // ID - Scope id of the resource + ID *string `json:"id,omitempty"` + // DisplayName - Display name of the resource + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of the resource + Type *string `json:"type,omitempty"` +} + +// Principal the name of the entity last modified it +type Principal struct { + // ID - The id of the principal made changes + ID *string `json:"id,omitempty"` + // DisplayName - The name of the principal made changes + DisplayName *string `json:"displayName,omitempty"` + // Type - Type of principal such as user , group etc + Type *string `json:"type,omitempty"` + // Email - Email of principal + Email *string `json:"email,omitempty"` +} + +// ProviderOperation operation +type ProviderOperation struct { + // Name - The operation name. + Name *string `json:"name,omitempty"` + // DisplayName - The operation display name. + DisplayName *string `json:"displayName,omitempty"` + // Description - The operation description. + Description *string `json:"description,omitempty"` + // Origin - The operation origin. + Origin *string `json:"origin,omitempty"` + // Properties - The operation properties. + Properties interface{} `json:"properties,omitempty"` + // IsDataAction - The dataAction flag to specify the operation type. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// ProviderOperationsMetadata provider Operations metadata +type ProviderOperationsMetadata struct { + autorest.Response `json:"-"` + // ID - The provider id. + ID *string `json:"id,omitempty"` + // Name - The provider name. + Name *string `json:"name,omitempty"` + // Type - The provider type. + Type *string `json:"type,omitempty"` + // DisplayName - The provider display name. + DisplayName *string `json:"displayName,omitempty"` + // ResourceTypes - The provider resource types + ResourceTypes *[]ResourceType `json:"resourceTypes,omitempty"` + // Operations - The provider operations. + Operations *[]ProviderOperation `json:"operations,omitempty"` +} + +// ProviderOperationsMetadataListResult provider operations metadata list +type ProviderOperationsMetadataListResult struct { + autorest.Response `json:"-"` + // Value - The list of providers. + Value *[]ProviderOperationsMetadata `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ProviderOperationsMetadataListResultIterator provides access to a complete listing of +// ProviderOperationsMetadata values. +type ProviderOperationsMetadataListResultIterator struct { + i int + page ProviderOperationsMetadataListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ProviderOperationsMetadataListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ProviderOperationsMetadataListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ProviderOperationsMetadataListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ProviderOperationsMetadataListResultIterator) Response() ProviderOperationsMetadataListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ProviderOperationsMetadataListResultIterator) Value() ProviderOperationsMetadata { + if !iter.page.NotDone() { + return ProviderOperationsMetadata{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ProviderOperationsMetadataListResultIterator type. +func NewProviderOperationsMetadataListResultIterator(page ProviderOperationsMetadataListResultPage) ProviderOperationsMetadataListResultIterator { + return ProviderOperationsMetadataListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (pomlr ProviderOperationsMetadataListResult) IsEmpty() bool { + return pomlr.Value == nil || len(*pomlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (pomlr ProviderOperationsMetadataListResult) hasNextLink() bool { + return pomlr.NextLink != nil && len(*pomlr.NextLink) != 0 +} + +// providerOperationsMetadataListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (pomlr ProviderOperationsMetadataListResult) providerOperationsMetadataListResultPreparer(ctx context.Context) (*http.Request, error) { + if !pomlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(pomlr.NextLink))) +} + +// ProviderOperationsMetadataListResultPage contains a page of ProviderOperationsMetadata values. +type ProviderOperationsMetadataListResultPage struct { + fn func(context.Context, ProviderOperationsMetadataListResult) (ProviderOperationsMetadataListResult, error) + pomlr ProviderOperationsMetadataListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ProviderOperationsMetadataListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.pomlr) + if err != nil { + return err + } + page.pomlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ProviderOperationsMetadataListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ProviderOperationsMetadataListResultPage) NotDone() bool { + return !page.pomlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ProviderOperationsMetadataListResultPage) Response() ProviderOperationsMetadataListResult { + return page.pomlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ProviderOperationsMetadataListResultPage) Values() []ProviderOperationsMetadata { + if page.pomlr.IsEmpty() { + return nil + } + return *page.pomlr.Value +} + +// Creates a new instance of the ProviderOperationsMetadataListResultPage type. +func NewProviderOperationsMetadataListResultPage(cur ProviderOperationsMetadataListResult, getNextPage func(context.Context, ProviderOperationsMetadataListResult) (ProviderOperationsMetadataListResult, error)) ProviderOperationsMetadataListResultPage { + return ProviderOperationsMetadataListResultPage{ + fn: getNextPage, + pomlr: cur, + } +} + +// ResourceType resource Type +type ResourceType struct { + // Name - The resource type name. + Name *string `json:"name,omitempty"` + // DisplayName - The resource type display name. + DisplayName *string `json:"displayName,omitempty"` + // Operations - The resource type operations. + Operations *[]ProviderOperation `json:"operations,omitempty"` +} + +// RoleAssignment role Assignments +type RoleAssignment struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role assignment ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role assignment name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role assignment type. + Type *string `json:"type,omitempty"` + // RoleAssignmentProperties - Role assignment properties. + *RoleAssignmentProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignment. +func (ra RoleAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ra.RoleAssignmentProperties != nil { + objectMap["properties"] = ra.RoleAssignmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleAssignment struct. +func (ra *RoleAssignment) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ra.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ra.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ra.Type = &typeVar + } + case "properties": + if v != nil { + var roleAssignmentProperties RoleAssignmentProperties + err = json.Unmarshal(*v, &roleAssignmentProperties) + if err != nil { + return err + } + ra.RoleAssignmentProperties = &roleAssignmentProperties + } + } + } + + return nil +} + +// RoleAssignmentCreateParameters role assignment create parameters. +type RoleAssignmentCreateParameters struct { + // RoleAssignmentProperties - Role assignment properties. + *RoleAssignmentProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentCreateParameters. +func (racp RoleAssignmentCreateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if racp.RoleAssignmentProperties != nil { + objectMap["properties"] = racp.RoleAssignmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleAssignmentCreateParameters struct. +func (racp *RoleAssignmentCreateParameters) 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 roleAssignmentProperties RoleAssignmentProperties + err = json.Unmarshal(*v, &roleAssignmentProperties) + if err != nil { + return err + } + racp.RoleAssignmentProperties = &roleAssignmentProperties + } + } + } + + return nil +} + +// RoleAssignmentFilter role Assignments filter +type RoleAssignmentFilter struct { + // PrincipalID - Returns role assignment of the specific principal. + PrincipalID *string `json:"principalId,omitempty"` +} + +// RoleAssignmentListResult role assignment list operation result. +type RoleAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - Role assignment list. + Value *[]RoleAssignment `json:"value,omitempty"` + // NextLink - READ-ONLY; The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentListResult. +func (ralr RoleAssignmentListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ralr.Value != nil { + objectMap["value"] = ralr.Value + } + return json.Marshal(objectMap) +} + +// RoleAssignmentListResultIterator provides access to a complete listing of RoleAssignment values. +type RoleAssignmentListResultIterator struct { + i int + page RoleAssignmentListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleAssignmentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleAssignmentListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleAssignmentListResultIterator) Response() RoleAssignmentListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleAssignmentListResultIterator) Value() RoleAssignment { + if !iter.page.NotDone() { + return RoleAssignment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleAssignmentListResultIterator type. +func NewRoleAssignmentListResultIterator(page RoleAssignmentListResultPage) RoleAssignmentListResultIterator { + return RoleAssignmentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ralr RoleAssignmentListResult) IsEmpty() bool { + return ralr.Value == nil || len(*ralr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ralr RoleAssignmentListResult) hasNextLink() bool { + return ralr.NextLink != nil && len(*ralr.NextLink) != 0 +} + +// roleAssignmentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ralr RoleAssignmentListResult) roleAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !ralr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ralr.NextLink))) +} + +// RoleAssignmentListResultPage contains a page of RoleAssignment values. +type RoleAssignmentListResultPage struct { + fn func(context.Context, RoleAssignmentListResult) (RoleAssignmentListResult, error) + ralr RoleAssignmentListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ralr) + if err != nil { + return err + } + page.ralr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleAssignmentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleAssignmentListResultPage) NotDone() bool { + return !page.ralr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleAssignmentListResultPage) Response() RoleAssignmentListResult { + return page.ralr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleAssignmentListResultPage) Values() []RoleAssignment { + if page.ralr.IsEmpty() { + return nil + } + return *page.ralr.Value +} + +// Creates a new instance of the RoleAssignmentListResultPage type. +func NewRoleAssignmentListResultPage(cur RoleAssignmentListResult, getNextPage func(context.Context, RoleAssignmentListResult) (RoleAssignmentListResult, error)) RoleAssignmentListResultPage { + return RoleAssignmentListResultPage{ + fn: getNextPage, + ralr: cur, + } +} + +// RoleAssignmentMetricsResult role Assignment Metrics +type RoleAssignmentMetricsResult struct { + autorest.Response `json:"-"` + // SubscriptionID - READ-ONLY; The subscription ID. + SubscriptionID *string `json:"subscriptionId,omitempty"` + // RoleAssignmentsLimit - READ-ONLY; The role assignment limit. + RoleAssignmentsLimit *int64 `json:"roleAssignmentsLimit,omitempty"` + // RoleAssignmentsCurrentCount - READ-ONLY; The number of current role assignments. + RoleAssignmentsCurrentCount *int64 `json:"roleAssignmentsCurrentCount,omitempty"` + // RoleAssignmentsRemainingCount - READ-ONLY; The number of remaining role assignments available. + RoleAssignmentsRemainingCount *int64 `json:"roleAssignmentsRemainingCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentMetricsResult. +func (ramr RoleAssignmentMetricsResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RoleAssignmentProperties role assignment properties. +type RoleAssignmentProperties struct { + // Scope - READ-ONLY; The role assignment scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalID - The principal ID. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeServicePrincipal', 'PrincipalTypeForeignGroup', 'PrincipalTypeDevice' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // Description - Description of role assignment + Description *string `json:"description,omitempty"` + // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' + Condition *string `json:"condition,omitempty"` + // ConditionVersion - Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string `json:"conditionVersion,omitempty"` + // CreatedOn - READ-ONLY; Time it was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // UpdatedOn - READ-ONLY; Time it was updated + UpdatedOn *date.Time `json:"updatedOn,omitempty"` + // CreatedBy - READ-ONLY; Id of the user who created the assignment + CreatedBy *string `json:"createdBy,omitempty"` + // UpdatedBy - READ-ONLY; Id of the user who updated the assignment + UpdatedBy *string `json:"updatedBy,omitempty"` + // DelegatedManagedIdentityResourceID - Id of the delegated managed identity resource + DelegatedManagedIdentityResourceID *string `json:"delegatedManagedIdentityResourceId,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentProperties. +func (rap RoleAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rap.RoleDefinitionID != nil { + objectMap["roleDefinitionId"] = rap.RoleDefinitionID + } + if rap.PrincipalID != nil { + objectMap["principalId"] = rap.PrincipalID + } + if rap.PrincipalType != "" { + objectMap["principalType"] = rap.PrincipalType + } + if rap.Description != nil { + objectMap["description"] = rap.Description + } + if rap.Condition != nil { + objectMap["condition"] = rap.Condition + } + if rap.ConditionVersion != nil { + objectMap["conditionVersion"] = rap.ConditionVersion + } + if rap.DelegatedManagedIdentityResourceID != nil { + objectMap["delegatedManagedIdentityResourceId"] = rap.DelegatedManagedIdentityResourceID + } + return json.Marshal(objectMap) +} + +// RoleAssignmentSchedule role Assignment schedule +type RoleAssignmentSchedule struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role assignment schedule Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role assignment schedule name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role assignment schedule type. + Type *string `json:"type,omitempty"` + // RoleAssignmentScheduleProperties - Role assignment schedule properties. + *RoleAssignmentScheduleProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentSchedule. +func (ras RoleAssignmentSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ras.RoleAssignmentScheduleProperties != nil { + objectMap["properties"] = ras.RoleAssignmentScheduleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleAssignmentSchedule struct. +func (ras *RoleAssignmentSchedule) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ras.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ras.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ras.Type = &typeVar + } + case "properties": + if v != nil { + var roleAssignmentScheduleProperties RoleAssignmentScheduleProperties + err = json.Unmarshal(*v, &roleAssignmentScheduleProperties) + if err != nil { + return err + } + ras.RoleAssignmentScheduleProperties = &roleAssignmentScheduleProperties + } + } + } + + return nil +} + +// RoleAssignmentScheduleFilter role assignment schedule filter +type RoleAssignmentScheduleFilter struct { + // PrincipalID - Returns role assignment schedule of the specific principal. + PrincipalID *string `json:"principalId,omitempty"` + // RoleDefinitionID - Returns role assignment schedule of the specific role definition. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // Status - Returns role assignment schedule instances of the specific status. + Status *string `json:"status,omitempty"` +} + +// RoleAssignmentScheduleInstance information about current or upcoming role assignment schedule instance +type RoleAssignmentScheduleInstance struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role assignment schedule instance ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role assignment schedule instance name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role assignment schedule instance type. + Type *string `json:"type,omitempty"` + // RoleAssignmentScheduleInstanceProperties - Role assignment schedule instance properties. + *RoleAssignmentScheduleInstanceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentScheduleInstance. +func (rasi RoleAssignmentScheduleInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rasi.RoleAssignmentScheduleInstanceProperties != nil { + objectMap["properties"] = rasi.RoleAssignmentScheduleInstanceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleAssignmentScheduleInstance struct. +func (rasi *RoleAssignmentScheduleInstance) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rasi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rasi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rasi.Type = &typeVar + } + case "properties": + if v != nil { + var roleAssignmentScheduleInstanceProperties RoleAssignmentScheduleInstanceProperties + err = json.Unmarshal(*v, &roleAssignmentScheduleInstanceProperties) + if err != nil { + return err + } + rasi.RoleAssignmentScheduleInstanceProperties = &roleAssignmentScheduleInstanceProperties + } + } + } + + return nil +} + +// RoleAssignmentScheduleInstanceFilter role assignment schedule instance filter +type RoleAssignmentScheduleInstanceFilter struct { + // PrincipalID - Returns role assignment schedule instances of the specific principal. + PrincipalID *string `json:"principalId,omitempty"` + // RoleDefinitionID - Returns role assignment schedule instances of the specific role definition. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // Status - Returns role assignment schedule instances of the specific status. + Status *string `json:"status,omitempty"` + // RoleAssignmentScheduleID - Returns role assignment schedule instances belonging to a specific role assignment schedule. + RoleAssignmentScheduleID *string `json:"roleAssignmentScheduleId,omitempty"` +} + +// RoleAssignmentScheduleInstanceListResult role assignment schedule instance list operation result. +type RoleAssignmentScheduleInstanceListResult struct { + autorest.Response `json:"-"` + // Value - Role assignment schedule instance list. + Value *[]RoleAssignmentScheduleInstance `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleAssignmentScheduleInstanceListResultIterator provides access to a complete listing of +// RoleAssignmentScheduleInstance values. +type RoleAssignmentScheduleInstanceListResultIterator struct { + i int + page RoleAssignmentScheduleInstanceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleAssignmentScheduleInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleInstanceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleAssignmentScheduleInstanceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleAssignmentScheduleInstanceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleAssignmentScheduleInstanceListResultIterator) Response() RoleAssignmentScheduleInstanceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleAssignmentScheduleInstanceListResultIterator) Value() RoleAssignmentScheduleInstance { + if !iter.page.NotDone() { + return RoleAssignmentScheduleInstance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleAssignmentScheduleInstanceListResultIterator type. +func NewRoleAssignmentScheduleInstanceListResultIterator(page RoleAssignmentScheduleInstanceListResultPage) RoleAssignmentScheduleInstanceListResultIterator { + return RoleAssignmentScheduleInstanceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rasilr RoleAssignmentScheduleInstanceListResult) IsEmpty() bool { + return rasilr.Value == nil || len(*rasilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rasilr RoleAssignmentScheduleInstanceListResult) hasNextLink() bool { + return rasilr.NextLink != nil && len(*rasilr.NextLink) != 0 +} + +// roleAssignmentScheduleInstanceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rasilr RoleAssignmentScheduleInstanceListResult) roleAssignmentScheduleInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rasilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rasilr.NextLink))) +} + +// RoleAssignmentScheduleInstanceListResultPage contains a page of RoleAssignmentScheduleInstance values. +type RoleAssignmentScheduleInstanceListResultPage struct { + fn func(context.Context, RoleAssignmentScheduleInstanceListResult) (RoleAssignmentScheduleInstanceListResult, error) + rasilr RoleAssignmentScheduleInstanceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleAssignmentScheduleInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleInstanceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rasilr) + if err != nil { + return err + } + page.rasilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleAssignmentScheduleInstanceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleAssignmentScheduleInstanceListResultPage) NotDone() bool { + return !page.rasilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleAssignmentScheduleInstanceListResultPage) Response() RoleAssignmentScheduleInstanceListResult { + return page.rasilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleAssignmentScheduleInstanceListResultPage) Values() []RoleAssignmentScheduleInstance { + if page.rasilr.IsEmpty() { + return nil + } + return *page.rasilr.Value +} + +// Creates a new instance of the RoleAssignmentScheduleInstanceListResultPage type. +func NewRoleAssignmentScheduleInstanceListResultPage(cur RoleAssignmentScheduleInstanceListResult, getNextPage func(context.Context, RoleAssignmentScheduleInstanceListResult) (RoleAssignmentScheduleInstanceListResult, error)) RoleAssignmentScheduleInstanceListResultPage { + return RoleAssignmentScheduleInstanceListResultPage{ + fn: getNextPage, + rasilr: cur, + } +} + +// RoleAssignmentScheduleInstanceProperties role assignment schedule properties with scope. +type RoleAssignmentScheduleInstanceProperties struct { + // Scope - The role assignment schedule scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalID - The principal ID. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeServicePrincipal', 'PrincipalTypeForeignGroup', 'PrincipalTypeDevice' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // RoleAssignmentScheduleID - Id of the master role assignment schedule + RoleAssignmentScheduleID *string `json:"roleAssignmentScheduleId,omitempty"` + // OriginRoleAssignmentID - Role Assignment Id in external system + OriginRoleAssignmentID *string `json:"originRoleAssignmentId,omitempty"` + // Status - The status of the role assignment schedule instance. Possible values include: 'Accepted', 'PendingEvaluation', 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', 'PendingApprovalProvisioning', 'PendingApproval', 'FailedAsResourceIsLocked', 'PendingAdminDecision', 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', 'PendingExternalProvisioning' + Status Status `json:"status,omitempty"` + // StartDateTime - The startDateTime of the role assignment schedule instance + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // EndDateTime - The endDateTime of the role assignment schedule instance + EndDateTime *date.Time `json:"endDateTime,omitempty"` + // LinkedRoleEligibilityScheduleID - roleEligibilityScheduleId used to activate + LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` + // LinkedRoleEligibilityScheduleInstanceID - roleEligibilityScheduleInstanceId linked to this roleAssignmentScheduleInstance + LinkedRoleEligibilityScheduleInstanceID *string `json:"linkedRoleEligibilityScheduleInstanceId,omitempty"` + // AssignmentType - Assignment type of the role assignment schedule. Possible values include: 'AssignmentTypeActivated', 'AssignmentTypeAssigned' + AssignmentType AssignmentType `json:"assignmentType,omitempty"` + // MemberType - Membership type of the role assignment schedule. Possible values include: 'Inherited', 'Direct', 'Group' + MemberType MemberType `json:"memberType,omitempty"` + // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' + Condition *string `json:"condition,omitempty"` + // ConditionVersion - Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string `json:"conditionVersion,omitempty"` + // CreatedOn - DateTime when role assignment schedule was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ExpandedProperties - Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` +} + +// RoleAssignmentScheduleListResult role assignment schedule list operation result. +type RoleAssignmentScheduleListResult struct { + autorest.Response `json:"-"` + // Value - Role assignment schedule list. + Value *[]RoleAssignmentSchedule `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleAssignmentScheduleListResultIterator provides access to a complete listing of RoleAssignmentSchedule +// values. +type RoleAssignmentScheduleListResultIterator struct { + i int + page RoleAssignmentScheduleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleAssignmentScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleAssignmentScheduleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleAssignmentScheduleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleAssignmentScheduleListResultIterator) Response() RoleAssignmentScheduleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleAssignmentScheduleListResultIterator) Value() RoleAssignmentSchedule { + if !iter.page.NotDone() { + return RoleAssignmentSchedule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleAssignmentScheduleListResultIterator type. +func NewRoleAssignmentScheduleListResultIterator(page RoleAssignmentScheduleListResultPage) RoleAssignmentScheduleListResultIterator { + return RoleAssignmentScheduleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (raslr RoleAssignmentScheduleListResult) IsEmpty() bool { + return raslr.Value == nil || len(*raslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (raslr RoleAssignmentScheduleListResult) hasNextLink() bool { + return raslr.NextLink != nil && len(*raslr.NextLink) != 0 +} + +// roleAssignmentScheduleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (raslr RoleAssignmentScheduleListResult) roleAssignmentScheduleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !raslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(raslr.NextLink))) +} + +// RoleAssignmentScheduleListResultPage contains a page of RoleAssignmentSchedule values. +type RoleAssignmentScheduleListResultPage struct { + fn func(context.Context, RoleAssignmentScheduleListResult) (RoleAssignmentScheduleListResult, error) + raslr RoleAssignmentScheduleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleAssignmentScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.raslr) + if err != nil { + return err + } + page.raslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleAssignmentScheduleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleAssignmentScheduleListResultPage) NotDone() bool { + return !page.raslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleAssignmentScheduleListResultPage) Response() RoleAssignmentScheduleListResult { + return page.raslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleAssignmentScheduleListResultPage) Values() []RoleAssignmentSchedule { + if page.raslr.IsEmpty() { + return nil + } + return *page.raslr.Value +} + +// Creates a new instance of the RoleAssignmentScheduleListResultPage type. +func NewRoleAssignmentScheduleListResultPage(cur RoleAssignmentScheduleListResult, getNextPage func(context.Context, RoleAssignmentScheduleListResult) (RoleAssignmentScheduleListResult, error)) RoleAssignmentScheduleListResultPage { + return RoleAssignmentScheduleListResultPage{ + fn: getNextPage, + raslr: cur, + } +} + +// RoleAssignmentScheduleProperties role assignment schedule properties with scope. +type RoleAssignmentScheduleProperties struct { + // Scope - The role assignment schedule scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalID - The principal ID. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeServicePrincipal', 'PrincipalTypeForeignGroup', 'PrincipalTypeDevice' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // RoleAssignmentScheduleRequestID - The id of roleAssignmentScheduleRequest used to create this roleAssignmentSchedule + RoleAssignmentScheduleRequestID *string `json:"roleAssignmentScheduleRequestId,omitempty"` + // LinkedRoleEligibilityScheduleID - The id of roleEligibilitySchedule used to activated this roleAssignmentSchedule + LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` + // AssignmentType - Assignment type of the role assignment schedule. Possible values include: 'AssignmentTypeActivated', 'AssignmentTypeAssigned' + AssignmentType AssignmentType `json:"assignmentType,omitempty"` + // MemberType - Membership type of the role assignment schedule. Possible values include: 'Inherited', 'Direct', 'Group' + MemberType MemberType `json:"memberType,omitempty"` + // Status - The status of the role assignment schedule. Possible values include: 'Accepted', 'PendingEvaluation', 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', 'PendingApprovalProvisioning', 'PendingApproval', 'FailedAsResourceIsLocked', 'PendingAdminDecision', 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', 'PendingExternalProvisioning' + Status Status `json:"status,omitempty"` + // StartDateTime - Start DateTime when role assignment schedule + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // EndDateTime - End DateTime when role assignment schedule + EndDateTime *date.Time `json:"endDateTime,omitempty"` + // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' + Condition *string `json:"condition,omitempty"` + // ConditionVersion - Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string `json:"conditionVersion,omitempty"` + // CreatedOn - DateTime when role assignment schedule was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // UpdatedOn - DateTime when role assignment schedule was modified + UpdatedOn *date.Time `json:"updatedOn,omitempty"` + // ExpandedProperties - Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` +} + +// RoleAssignmentScheduleRequest role Assignment schedule request +type RoleAssignmentScheduleRequest struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role assignment schedule request ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role assignment schedule request name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role assignment schedule request type. + Type *string `json:"type,omitempty"` + // RoleAssignmentScheduleRequestProperties - Role assignment schedule request properties. + *RoleAssignmentScheduleRequestProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentScheduleRequest. +func (rasr RoleAssignmentScheduleRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rasr.RoleAssignmentScheduleRequestProperties != nil { + objectMap["properties"] = rasr.RoleAssignmentScheduleRequestProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleAssignmentScheduleRequest struct. +func (rasr *RoleAssignmentScheduleRequest) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rasr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rasr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rasr.Type = &typeVar + } + case "properties": + if v != nil { + var roleAssignmentScheduleRequestProperties RoleAssignmentScheduleRequestProperties + err = json.Unmarshal(*v, &roleAssignmentScheduleRequestProperties) + if err != nil { + return err + } + rasr.RoleAssignmentScheduleRequestProperties = &roleAssignmentScheduleRequestProperties + } + } + } + + return nil +} + +// RoleAssignmentScheduleRequestFilter role assignment schedule request filter +type RoleAssignmentScheduleRequestFilter struct { + // PrincipalID - Returns role assignment requests of the specific principal. + PrincipalID *string `json:"principalId,omitempty"` + // RoleDefinitionID - Returns role assignment requests of the specific role definition. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // RequestorID - Returns role assignment requests created by specific principal. + RequestorID *string `json:"requestorId,omitempty"` + // Status - Returns role assignment requests of specific status. + Status *string `json:"status,omitempty"` +} + +// RoleAssignmentScheduleRequestListResult role assignment schedule request list operation result. +type RoleAssignmentScheduleRequestListResult struct { + autorest.Response `json:"-"` + // Value - Role assignment schedule request list. + Value *[]RoleAssignmentScheduleRequest `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleAssignmentScheduleRequestListResultIterator provides access to a complete listing of +// RoleAssignmentScheduleRequest values. +type RoleAssignmentScheduleRequestListResultIterator struct { + i int + page RoleAssignmentScheduleRequestListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleAssignmentScheduleRequestListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleRequestListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleAssignmentScheduleRequestListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleAssignmentScheduleRequestListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleAssignmentScheduleRequestListResultIterator) Response() RoleAssignmentScheduleRequestListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleAssignmentScheduleRequestListResultIterator) Value() RoleAssignmentScheduleRequest { + if !iter.page.NotDone() { + return RoleAssignmentScheduleRequest{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleAssignmentScheduleRequestListResultIterator type. +func NewRoleAssignmentScheduleRequestListResultIterator(page RoleAssignmentScheduleRequestListResultPage) RoleAssignmentScheduleRequestListResultIterator { + return RoleAssignmentScheduleRequestListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rasrlr RoleAssignmentScheduleRequestListResult) IsEmpty() bool { + return rasrlr.Value == nil || len(*rasrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rasrlr RoleAssignmentScheduleRequestListResult) hasNextLink() bool { + return rasrlr.NextLink != nil && len(*rasrlr.NextLink) != 0 +} + +// roleAssignmentScheduleRequestListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rasrlr RoleAssignmentScheduleRequestListResult) roleAssignmentScheduleRequestListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rasrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rasrlr.NextLink))) +} + +// RoleAssignmentScheduleRequestListResultPage contains a page of RoleAssignmentScheduleRequest values. +type RoleAssignmentScheduleRequestListResultPage struct { + fn func(context.Context, RoleAssignmentScheduleRequestListResult) (RoleAssignmentScheduleRequestListResult, error) + rasrlr RoleAssignmentScheduleRequestListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleAssignmentScheduleRequestListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleRequestListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rasrlr) + if err != nil { + return err + } + page.rasrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleAssignmentScheduleRequestListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleAssignmentScheduleRequestListResultPage) NotDone() bool { + return !page.rasrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleAssignmentScheduleRequestListResultPage) Response() RoleAssignmentScheduleRequestListResult { + return page.rasrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleAssignmentScheduleRequestListResultPage) Values() []RoleAssignmentScheduleRequest { + if page.rasrlr.IsEmpty() { + return nil + } + return *page.rasrlr.Value +} + +// Creates a new instance of the RoleAssignmentScheduleRequestListResultPage type. +func NewRoleAssignmentScheduleRequestListResultPage(cur RoleAssignmentScheduleRequestListResult, getNextPage func(context.Context, RoleAssignmentScheduleRequestListResult) (RoleAssignmentScheduleRequestListResult, error)) RoleAssignmentScheduleRequestListResultPage { + return RoleAssignmentScheduleRequestListResultPage{ + fn: getNextPage, + rasrlr: cur, + } +} + +// RoleAssignmentScheduleRequestProperties role assignment schedule request properties with scope. +type RoleAssignmentScheduleRequestProperties struct { + // Scope - READ-ONLY; The role assignment schedule request scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalID - The principal ID. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - READ-ONLY; The principal type of the assigned principal ID. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeServicePrincipal', 'PrincipalTypeForeignGroup', 'PrincipalTypeDevice' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // RequestType - The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc. Possible values include: 'AdminAssign', 'AdminRemove', 'AdminUpdate', 'AdminExtend', 'AdminRenew', 'SelfActivate', 'SelfDeactivate', 'SelfExtend', 'SelfRenew' + RequestType RequestType `json:"requestType,omitempty"` + // Status - READ-ONLY; The status of the role assignment schedule request. Possible values include: 'Accepted', 'PendingEvaluation', 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', 'PendingApprovalProvisioning', 'PendingApproval', 'FailedAsResourceIsLocked', 'PendingAdminDecision', 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', 'PendingExternalProvisioning' + Status Status `json:"status,omitempty"` + // ApprovalID - READ-ONLY; The approvalId of the role assignment schedule request. + ApprovalID *string `json:"approvalId,omitempty"` + // TargetRoleAssignmentScheduleID - The resultant role assignment schedule id or the role assignment schedule id being updated + TargetRoleAssignmentScheduleID *string `json:"targetRoleAssignmentScheduleId,omitempty"` + // TargetRoleAssignmentScheduleInstanceID - The role assignment schedule instance id being updated + TargetRoleAssignmentScheduleInstanceID *string `json:"targetRoleAssignmentScheduleInstanceId,omitempty"` + // ScheduleInfo - Schedule info of the role assignment schedule + ScheduleInfo *RoleAssignmentScheduleRequestPropertiesScheduleInfo `json:"scheduleInfo,omitempty"` + // LinkedRoleEligibilityScheduleID - The linked role eligibility schedule id - to activate an eligibility. + LinkedRoleEligibilityScheduleID *string `json:"linkedRoleEligibilityScheduleId,omitempty"` + // Justification - Justification for the role assignment + Justification *string `json:"justification,omitempty"` + // TicketInfo - Ticket Info of the role assignment + TicketInfo *RoleAssignmentScheduleRequestPropertiesTicketInfo `json:"ticketInfo,omitempty"` + // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' + Condition *string `json:"condition,omitempty"` + // ConditionVersion - Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string `json:"conditionVersion,omitempty"` + // CreatedOn - READ-ONLY; DateTime when role assignment schedule request was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // RequestorID - READ-ONLY; Id of the user who created this request + RequestorID *string `json:"requestorId,omitempty"` + // ExpandedProperties - READ-ONLY; Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleAssignmentScheduleRequestProperties. +func (rasrp RoleAssignmentScheduleRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rasrp.RoleDefinitionID != nil { + objectMap["roleDefinitionId"] = rasrp.RoleDefinitionID + } + if rasrp.PrincipalID != nil { + objectMap["principalId"] = rasrp.PrincipalID + } + if rasrp.RequestType != "" { + objectMap["requestType"] = rasrp.RequestType + } + if rasrp.TargetRoleAssignmentScheduleID != nil { + objectMap["targetRoleAssignmentScheduleId"] = rasrp.TargetRoleAssignmentScheduleID + } + if rasrp.TargetRoleAssignmentScheduleInstanceID != nil { + objectMap["targetRoleAssignmentScheduleInstanceId"] = rasrp.TargetRoleAssignmentScheduleInstanceID + } + if rasrp.ScheduleInfo != nil { + objectMap["scheduleInfo"] = rasrp.ScheduleInfo + } + if rasrp.LinkedRoleEligibilityScheduleID != nil { + objectMap["linkedRoleEligibilityScheduleId"] = rasrp.LinkedRoleEligibilityScheduleID + } + if rasrp.Justification != nil { + objectMap["justification"] = rasrp.Justification + } + if rasrp.TicketInfo != nil { + objectMap["ticketInfo"] = rasrp.TicketInfo + } + if rasrp.Condition != nil { + objectMap["condition"] = rasrp.Condition + } + if rasrp.ConditionVersion != nil { + objectMap["conditionVersion"] = rasrp.ConditionVersion + } + return json.Marshal(objectMap) +} + +// RoleAssignmentScheduleRequestPropertiesScheduleInfo schedule info of the role assignment schedule +type RoleAssignmentScheduleRequestPropertiesScheduleInfo struct { + // StartDateTime - Start DateTime of the role assignment schedule. + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // Expiration - Expiration of the role assignment schedule + Expiration *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration `json:"expiration,omitempty"` +} + +// RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration expiration of the role assignment schedule +type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration struct { + // Type - Type of the role assignment schedule expiration. Possible values include: 'AfterDuration', 'AfterDateTime', 'NoExpiration' + Type Type `json:"type,omitempty"` + // EndDateTime - End DateTime of the role assignment schedule. + EndDateTime *date.Time `json:"endDateTime,omitempty"` + // Duration - Duration of the role assignment schedule in TimeSpan. + Duration *string `json:"duration,omitempty"` +} + +// RoleAssignmentScheduleRequestPropertiesTicketInfo ticket Info of the role assignment +type RoleAssignmentScheduleRequestPropertiesTicketInfo struct { + // TicketNumber - Ticket number for the role assignment + TicketNumber *string `json:"ticketNumber,omitempty"` + // TicketSystem - Ticket system name for the role assignment + TicketSystem *string `json:"ticketSystem,omitempty"` +} + +// RoleDefinition role definition. +type RoleDefinition struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role definition ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role definition name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role definition type. + Type *string `json:"type,omitempty"` + // RoleDefinitionProperties - Role definition properties. + *RoleDefinitionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleDefinition. +func (rd RoleDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rd.RoleDefinitionProperties != nil { + objectMap["properties"] = rd.RoleDefinitionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleDefinition struct. +func (rd *RoleDefinition) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rd.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rd.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rd.Type = &typeVar + } + case "properties": + if v != nil { + var roleDefinitionProperties RoleDefinitionProperties + err = json.Unmarshal(*v, &roleDefinitionProperties) + if err != nil { + return err + } + rd.RoleDefinitionProperties = &roleDefinitionProperties + } + } + } + + return nil +} + +// RoleDefinitionFilter role Definitions filter +type RoleDefinitionFilter struct { + // RoleName - Returns role definition with the specific name. + RoleName *string `json:"roleName,omitempty"` + // Type - Returns role definition with the specific type. + Type *string `json:"type,omitempty"` +} + +// RoleDefinitionListResult role definition list operation result. +type RoleDefinitionListResult struct { + autorest.Response `json:"-"` + // Value - Role definition list. + Value *[]RoleDefinition `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleDefinitionListResultIterator provides access to a complete listing of RoleDefinition values. +type RoleDefinitionListResultIterator struct { + i int + page RoleDefinitionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleDefinitionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleDefinitionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleDefinitionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleDefinitionListResultIterator) Response() RoleDefinitionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleDefinitionListResultIterator) Value() RoleDefinition { + if !iter.page.NotDone() { + return RoleDefinition{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleDefinitionListResultIterator type. +func NewRoleDefinitionListResultIterator(page RoleDefinitionListResultPage) RoleDefinitionListResultIterator { + return RoleDefinitionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rdlr RoleDefinitionListResult) IsEmpty() bool { + return rdlr.Value == nil || len(*rdlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rdlr RoleDefinitionListResult) hasNextLink() bool { + return rdlr.NextLink != nil && len(*rdlr.NextLink) != 0 +} + +// roleDefinitionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rdlr RoleDefinitionListResult) roleDefinitionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rdlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rdlr.NextLink))) +} + +// RoleDefinitionListResultPage contains a page of RoleDefinition values. +type RoleDefinitionListResultPage struct { + fn func(context.Context, RoleDefinitionListResult) (RoleDefinitionListResult, error) + rdlr RoleDefinitionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleDefinitionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rdlr) + if err != nil { + return err + } + page.rdlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleDefinitionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleDefinitionListResultPage) NotDone() bool { + return !page.rdlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleDefinitionListResultPage) Response() RoleDefinitionListResult { + return page.rdlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleDefinitionListResultPage) Values() []RoleDefinition { + if page.rdlr.IsEmpty() { + return nil + } + return *page.rdlr.Value +} + +// Creates a new instance of the RoleDefinitionListResultPage type. +func NewRoleDefinitionListResultPage(cur RoleDefinitionListResult, getNextPage func(context.Context, RoleDefinitionListResult) (RoleDefinitionListResult, error)) RoleDefinitionListResultPage { + return RoleDefinitionListResultPage{ + fn: getNextPage, + rdlr: cur, + } +} + +// RoleDefinitionProperties role definition properties. +type RoleDefinitionProperties struct { + // RoleName - The role name. + RoleName *string `json:"roleName,omitempty"` + // Description - The role definition description. + Description *string `json:"description,omitempty"` + // RoleType - The role type. + RoleType *string `json:"type,omitempty"` + // Permissions - Role definition permissions. + Permissions *[]Permission `json:"permissions,omitempty"` + // AssignableScopes - Role definition assignable scopes. + AssignableScopes *[]string `json:"assignableScopes,omitempty"` +} + +// RoleEligibilitySchedule role eligibility schedule +type RoleEligibilitySchedule struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role eligibility schedule Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role eligibility schedule name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role eligibility schedule type. + Type *string `json:"type,omitempty"` + // RoleEligibilityScheduleProperties - role eligibility schedule properties. + *RoleEligibilityScheduleProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleEligibilitySchedule. +func (res RoleEligibilitySchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if res.RoleEligibilityScheduleProperties != nil { + objectMap["properties"] = res.RoleEligibilityScheduleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleEligibilitySchedule struct. +func (res *RoleEligibilitySchedule) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + res.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + res.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + res.Type = &typeVar + } + case "properties": + if v != nil { + var roleEligibilityScheduleProperties RoleEligibilityScheduleProperties + err = json.Unmarshal(*v, &roleEligibilityScheduleProperties) + if err != nil { + return err + } + res.RoleEligibilityScheduleProperties = &roleEligibilityScheduleProperties + } + } + } + + return nil +} + +// RoleEligibilityScheduleFilter role eligibility schedule filter +type RoleEligibilityScheduleFilter struct { + // PrincipalID - Returns role eligibility schedule of the specific principal. + PrincipalID *string `json:"principalId,omitempty"` + // RoleDefinitionID - Returns role eligibility schedule of the specific role definition. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // Status - Returns role eligibility schedule of the specific status. + Status *string `json:"status,omitempty"` +} + +// RoleEligibilityScheduleInstance information about current or upcoming role eligibility schedule instance +type RoleEligibilityScheduleInstance struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role eligibility schedule instance ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role eligibility schedule instance name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role eligibility schedule instance type. + Type *string `json:"type,omitempty"` + // RoleEligibilityScheduleInstanceProperties - Role eligibility schedule instance properties. + *RoleEligibilityScheduleInstanceProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleEligibilityScheduleInstance. +func (resi RoleEligibilityScheduleInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if resi.RoleEligibilityScheduleInstanceProperties != nil { + objectMap["properties"] = resi.RoleEligibilityScheduleInstanceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleEligibilityScheduleInstance struct. +func (resi *RoleEligibilityScheduleInstance) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + resi.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + resi.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + resi.Type = &typeVar + } + case "properties": + if v != nil { + var roleEligibilityScheduleInstanceProperties RoleEligibilityScheduleInstanceProperties + err = json.Unmarshal(*v, &roleEligibilityScheduleInstanceProperties) + if err != nil { + return err + } + resi.RoleEligibilityScheduleInstanceProperties = &roleEligibilityScheduleInstanceProperties + } + } + } + + return nil +} + +// RoleEligibilityScheduleInstanceFilter role eligibility schedule instance filter +type RoleEligibilityScheduleInstanceFilter struct { + // PrincipalID - Returns role eligibility schedule instances of the specific principal. + PrincipalID *string `json:"principalId,omitempty"` + // RoleDefinitionID - Returns role eligibility schedule instances of the specific role definition. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // Status - Returns role eligibility schedule instances of the specific status. + Status *string `json:"status,omitempty"` + // RoleEligibilityScheduleID - Returns role eligibility schedule instances belonging to a specific role eligibility schedule. + RoleEligibilityScheduleID *string `json:"roleEligibilityScheduleId,omitempty"` +} + +// RoleEligibilityScheduleInstanceListResult role eligibility schedule instance list operation result. +type RoleEligibilityScheduleInstanceListResult struct { + autorest.Response `json:"-"` + // Value - Role eligibility schedule instance list. + Value *[]RoleEligibilityScheduleInstance `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleEligibilityScheduleInstanceListResultIterator provides access to a complete listing of +// RoleEligibilityScheduleInstance values. +type RoleEligibilityScheduleInstanceListResultIterator struct { + i int + page RoleEligibilityScheduleInstanceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleEligibilityScheduleInstanceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleInstanceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleEligibilityScheduleInstanceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleEligibilityScheduleInstanceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleEligibilityScheduleInstanceListResultIterator) Response() RoleEligibilityScheduleInstanceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleEligibilityScheduleInstanceListResultIterator) Value() RoleEligibilityScheduleInstance { + if !iter.page.NotDone() { + return RoleEligibilityScheduleInstance{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleEligibilityScheduleInstanceListResultIterator type. +func NewRoleEligibilityScheduleInstanceListResultIterator(page RoleEligibilityScheduleInstanceListResultPage) RoleEligibilityScheduleInstanceListResultIterator { + return RoleEligibilityScheduleInstanceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (resilr RoleEligibilityScheduleInstanceListResult) IsEmpty() bool { + return resilr.Value == nil || len(*resilr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (resilr RoleEligibilityScheduleInstanceListResult) hasNextLink() bool { + return resilr.NextLink != nil && len(*resilr.NextLink) != 0 +} + +// roleEligibilityScheduleInstanceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (resilr RoleEligibilityScheduleInstanceListResult) roleEligibilityScheduleInstanceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !resilr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(resilr.NextLink))) +} + +// RoleEligibilityScheduleInstanceListResultPage contains a page of RoleEligibilityScheduleInstance values. +type RoleEligibilityScheduleInstanceListResultPage struct { + fn func(context.Context, RoleEligibilityScheduleInstanceListResult) (RoleEligibilityScheduleInstanceListResult, error) + resilr RoleEligibilityScheduleInstanceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleEligibilityScheduleInstanceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleInstanceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.resilr) + if err != nil { + return err + } + page.resilr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleEligibilityScheduleInstanceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleEligibilityScheduleInstanceListResultPage) NotDone() bool { + return !page.resilr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleEligibilityScheduleInstanceListResultPage) Response() RoleEligibilityScheduleInstanceListResult { + return page.resilr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleEligibilityScheduleInstanceListResultPage) Values() []RoleEligibilityScheduleInstance { + if page.resilr.IsEmpty() { + return nil + } + return *page.resilr.Value +} + +// Creates a new instance of the RoleEligibilityScheduleInstanceListResultPage type. +func NewRoleEligibilityScheduleInstanceListResultPage(cur RoleEligibilityScheduleInstanceListResult, getNextPage func(context.Context, RoleEligibilityScheduleInstanceListResult) (RoleEligibilityScheduleInstanceListResult, error)) RoleEligibilityScheduleInstanceListResultPage { + return RoleEligibilityScheduleInstanceListResultPage{ + fn: getNextPage, + resilr: cur, + } +} + +// RoleEligibilityScheduleInstanceProperties role eligibility schedule properties with scope. +type RoleEligibilityScheduleInstanceProperties struct { + // Scope - The role eligibility schedule scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalID - The principal ID. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeServicePrincipal', 'PrincipalTypeForeignGroup', 'PrincipalTypeDevice' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // RoleEligibilityScheduleID - Id of the master role eligibility schedule + RoleEligibilityScheduleID *string `json:"roleEligibilityScheduleId,omitempty"` + // Status - The status of the role eligibility schedule instance. Possible values include: 'Accepted', 'PendingEvaluation', 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', 'PendingApprovalProvisioning', 'PendingApproval', 'FailedAsResourceIsLocked', 'PendingAdminDecision', 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', 'PendingExternalProvisioning' + Status Status `json:"status,omitempty"` + // StartDateTime - The startDateTime of the role eligibility schedule instance + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // EndDateTime - The endDateTime of the role eligibility schedule instance + EndDateTime *date.Time `json:"endDateTime,omitempty"` + // MemberType - Membership type of the role eligibility schedule. Possible values include: 'Inherited', 'Direct', 'Group' + MemberType MemberType `json:"memberType,omitempty"` + // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' + Condition *string `json:"condition,omitempty"` + // ConditionVersion - Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string `json:"conditionVersion,omitempty"` + // CreatedOn - DateTime when role eligibility schedule was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // ExpandedProperties - Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` +} + +// RoleEligibilityScheduleListResult role eligibility schedule list operation result. +type RoleEligibilityScheduleListResult struct { + autorest.Response `json:"-"` + // Value - role eligibility schedule list. + Value *[]RoleEligibilitySchedule `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleEligibilityScheduleListResultIterator provides access to a complete listing of +// RoleEligibilitySchedule values. +type RoleEligibilityScheduleListResultIterator struct { + i int + page RoleEligibilityScheduleListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleEligibilityScheduleListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleEligibilityScheduleListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleEligibilityScheduleListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleEligibilityScheduleListResultIterator) Response() RoleEligibilityScheduleListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleEligibilityScheduleListResultIterator) Value() RoleEligibilitySchedule { + if !iter.page.NotDone() { + return RoleEligibilitySchedule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleEligibilityScheduleListResultIterator type. +func NewRoleEligibilityScheduleListResultIterator(page RoleEligibilityScheduleListResultPage) RoleEligibilityScheduleListResultIterator { + return RoleEligibilityScheduleListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (reslr RoleEligibilityScheduleListResult) IsEmpty() bool { + return reslr.Value == nil || len(*reslr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (reslr RoleEligibilityScheduleListResult) hasNextLink() bool { + return reslr.NextLink != nil && len(*reslr.NextLink) != 0 +} + +// roleEligibilityScheduleListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (reslr RoleEligibilityScheduleListResult) roleEligibilityScheduleListResultPreparer(ctx context.Context) (*http.Request, error) { + if !reslr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(reslr.NextLink))) +} + +// RoleEligibilityScheduleListResultPage contains a page of RoleEligibilitySchedule values. +type RoleEligibilityScheduleListResultPage struct { + fn func(context.Context, RoleEligibilityScheduleListResult) (RoleEligibilityScheduleListResult, error) + reslr RoleEligibilityScheduleListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleEligibilityScheduleListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.reslr) + if err != nil { + return err + } + page.reslr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleEligibilityScheduleListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleEligibilityScheduleListResultPage) NotDone() bool { + return !page.reslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleEligibilityScheduleListResultPage) Response() RoleEligibilityScheduleListResult { + return page.reslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleEligibilityScheduleListResultPage) Values() []RoleEligibilitySchedule { + if page.reslr.IsEmpty() { + return nil + } + return *page.reslr.Value +} + +// Creates a new instance of the RoleEligibilityScheduleListResultPage type. +func NewRoleEligibilityScheduleListResultPage(cur RoleEligibilityScheduleListResult, getNextPage func(context.Context, RoleEligibilityScheduleListResult) (RoleEligibilityScheduleListResult, error)) RoleEligibilityScheduleListResultPage { + return RoleEligibilityScheduleListResultPage{ + fn: getNextPage, + reslr: cur, + } +} + +// RoleEligibilityScheduleProperties role eligibility schedule properties with scope. +type RoleEligibilityScheduleProperties struct { + // Scope - The role eligibility schedule scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalID - The principal ID. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - The principal type of the assigned principal ID. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeServicePrincipal', 'PrincipalTypeForeignGroup', 'PrincipalTypeDevice' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // RoleEligibilityScheduleRequestID - The id of roleEligibilityScheduleRequest used to create this roleAssignmentSchedule + RoleEligibilityScheduleRequestID *string `json:"roleEligibilityScheduleRequestId,omitempty"` + // MemberType - Membership type of the role eligibility schedule. Possible values include: 'Inherited', 'Direct', 'Group' + MemberType MemberType `json:"memberType,omitempty"` + // Status - The status of the role eligibility schedule. Possible values include: 'Accepted', 'PendingEvaluation', 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', 'PendingApprovalProvisioning', 'PendingApproval', 'FailedAsResourceIsLocked', 'PendingAdminDecision', 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', 'PendingExternalProvisioning' + Status Status `json:"status,omitempty"` + // StartDateTime - Start DateTime when role eligibility schedule + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // EndDateTime - End DateTime when role eligibility schedule + EndDateTime *date.Time `json:"endDateTime,omitempty"` + // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' + Condition *string `json:"condition,omitempty"` + // ConditionVersion - Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string `json:"conditionVersion,omitempty"` + // CreatedOn - DateTime when role eligibility schedule was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // UpdatedOn - DateTime when role eligibility schedule was modified + UpdatedOn *date.Time `json:"updatedOn,omitempty"` + // ExpandedProperties - Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` +} + +// RoleEligibilityScheduleRequest role Eligibility schedule request +type RoleEligibilityScheduleRequest struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role eligibility schedule request ID. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role eligibility schedule request name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role eligibility schedule request type. + Type *string `json:"type,omitempty"` + // RoleEligibilityScheduleRequestProperties - Role eligibility schedule request properties. + *RoleEligibilityScheduleRequestProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleEligibilityScheduleRequest. +func (resr RoleEligibilityScheduleRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if resr.RoleEligibilityScheduleRequestProperties != nil { + objectMap["properties"] = resr.RoleEligibilityScheduleRequestProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleEligibilityScheduleRequest struct. +func (resr *RoleEligibilityScheduleRequest) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + resr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + resr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + resr.Type = &typeVar + } + case "properties": + if v != nil { + var roleEligibilityScheduleRequestProperties RoleEligibilityScheduleRequestProperties + err = json.Unmarshal(*v, &roleEligibilityScheduleRequestProperties) + if err != nil { + return err + } + resr.RoleEligibilityScheduleRequestProperties = &roleEligibilityScheduleRequestProperties + } + } + } + + return nil +} + +// RoleEligibilityScheduleRequestFilter role eligibility schedule request filter +type RoleEligibilityScheduleRequestFilter struct { + // PrincipalID - Returns role eligibility requests of the specific principal. + PrincipalID *string `json:"principalId,omitempty"` + // RoleDefinitionID - Returns role eligibility requests of the specific role definition. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // RequestorID - Returns role eligibility requests created by specific principal. + RequestorID *string `json:"requestorId,omitempty"` + // Status - Returns role eligibility requests of specific status. + Status *string `json:"status,omitempty"` +} + +// RoleEligibilityScheduleRequestListResult role eligibility schedule request list operation result. +type RoleEligibilityScheduleRequestListResult struct { + autorest.Response `json:"-"` + // Value - Role eligibility schedule request list. + Value *[]RoleEligibilityScheduleRequest `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleEligibilityScheduleRequestListResultIterator provides access to a complete listing of +// RoleEligibilityScheduleRequest values. +type RoleEligibilityScheduleRequestListResultIterator struct { + i int + page RoleEligibilityScheduleRequestListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleEligibilityScheduleRequestListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleRequestListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleEligibilityScheduleRequestListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleEligibilityScheduleRequestListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleEligibilityScheduleRequestListResultIterator) Response() RoleEligibilityScheduleRequestListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleEligibilityScheduleRequestListResultIterator) Value() RoleEligibilityScheduleRequest { + if !iter.page.NotDone() { + return RoleEligibilityScheduleRequest{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleEligibilityScheduleRequestListResultIterator type. +func NewRoleEligibilityScheduleRequestListResultIterator(page RoleEligibilityScheduleRequestListResultPage) RoleEligibilityScheduleRequestListResultIterator { + return RoleEligibilityScheduleRequestListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (resrlr RoleEligibilityScheduleRequestListResult) IsEmpty() bool { + return resrlr.Value == nil || len(*resrlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (resrlr RoleEligibilityScheduleRequestListResult) hasNextLink() bool { + return resrlr.NextLink != nil && len(*resrlr.NextLink) != 0 +} + +// roleEligibilityScheduleRequestListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (resrlr RoleEligibilityScheduleRequestListResult) roleEligibilityScheduleRequestListResultPreparer(ctx context.Context) (*http.Request, error) { + if !resrlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(resrlr.NextLink))) +} + +// RoleEligibilityScheduleRequestListResultPage contains a page of RoleEligibilityScheduleRequest values. +type RoleEligibilityScheduleRequestListResultPage struct { + fn func(context.Context, RoleEligibilityScheduleRequestListResult) (RoleEligibilityScheduleRequestListResult, error) + resrlr RoleEligibilityScheduleRequestListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleEligibilityScheduleRequestListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleRequestListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.resrlr) + if err != nil { + return err + } + page.resrlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleEligibilityScheduleRequestListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleEligibilityScheduleRequestListResultPage) NotDone() bool { + return !page.resrlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleEligibilityScheduleRequestListResultPage) Response() RoleEligibilityScheduleRequestListResult { + return page.resrlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleEligibilityScheduleRequestListResultPage) Values() []RoleEligibilityScheduleRequest { + if page.resrlr.IsEmpty() { + return nil + } + return *page.resrlr.Value +} + +// Creates a new instance of the RoleEligibilityScheduleRequestListResultPage type. +func NewRoleEligibilityScheduleRequestListResultPage(cur RoleEligibilityScheduleRequestListResult, getNextPage func(context.Context, RoleEligibilityScheduleRequestListResult) (RoleEligibilityScheduleRequestListResult, error)) RoleEligibilityScheduleRequestListResultPage { + return RoleEligibilityScheduleRequestListResultPage{ + fn: getNextPage, + resrlr: cur, + } +} + +// RoleEligibilityScheduleRequestProperties role eligibility schedule request properties with scope. +type RoleEligibilityScheduleRequestProperties struct { + // Scope - READ-ONLY; The role eligibility schedule request scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition ID. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PrincipalID - The principal ID. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalType - READ-ONLY; The principal type of the assigned principal ID. Possible values include: 'PrincipalTypeUser', 'PrincipalTypeGroup', 'PrincipalTypeServicePrincipal', 'PrincipalTypeForeignGroup', 'PrincipalTypeDevice' + PrincipalType PrincipalType `json:"principalType,omitempty"` + // RequestType - The type of the role assignment schedule request. Eg: SelfActivate, AdminAssign etc. Possible values include: 'AdminAssign', 'AdminRemove', 'AdminUpdate', 'AdminExtend', 'AdminRenew', 'SelfActivate', 'SelfDeactivate', 'SelfExtend', 'SelfRenew' + RequestType RequestType `json:"requestType,omitempty"` + // Status - READ-ONLY; The status of the role eligibility schedule request. Possible values include: 'Accepted', 'PendingEvaluation', 'Granted', 'Denied', 'PendingProvisioning', 'Provisioned', 'PendingRevocation', 'Revoked', 'Canceled', 'Failed', 'PendingApprovalProvisioning', 'PendingApproval', 'FailedAsResourceIsLocked', 'PendingAdminDecision', 'AdminApproved', 'AdminDenied', 'TimedOut', 'ProvisioningStarted', 'Invalid', 'PendingScheduleCreation', 'ScheduleCreated', 'PendingExternalProvisioning' + Status Status `json:"status,omitempty"` + // ApprovalID - READ-ONLY; The approvalId of the role eligibility schedule request. + ApprovalID *string `json:"approvalId,omitempty"` + // ScheduleInfo - Schedule info of the role eligibility schedule + ScheduleInfo *RoleEligibilityScheduleRequestPropertiesScheduleInfo `json:"scheduleInfo,omitempty"` + // TargetRoleEligibilityScheduleID - The resultant role eligibility schedule id or the role eligibility schedule id being updated + TargetRoleEligibilityScheduleID *string `json:"targetRoleEligibilityScheduleId,omitempty"` + // TargetRoleEligibilityScheduleInstanceID - The role eligibility schedule instance id being updated + TargetRoleEligibilityScheduleInstanceID *string `json:"targetRoleEligibilityScheduleInstanceId,omitempty"` + // Justification - Justification for the role eligibility + Justification *string `json:"justification,omitempty"` + // TicketInfo - Ticket Info of the role eligibility + TicketInfo *RoleEligibilityScheduleRequestPropertiesTicketInfo `json:"ticketInfo,omitempty"` + // Condition - The conditions on the role assignment. This limits the resources it can be assigned to. e.g.: @Resource[Microsoft.Storage/storageAccounts/blobServices/containers:ContainerName] StringEqualsIgnoreCase 'foo_storage_container' + Condition *string `json:"condition,omitempty"` + // ConditionVersion - Version of the condition. Currently accepted value is '2.0' + ConditionVersion *string `json:"conditionVersion,omitempty"` + // CreatedOn - READ-ONLY; DateTime when role eligibility schedule request was created + CreatedOn *date.Time `json:"createdOn,omitempty"` + // RequestorID - READ-ONLY; Id of the user who created this request + RequestorID *string `json:"requestorId,omitempty"` + // ExpandedProperties - READ-ONLY; Additional properties of principal, scope and role definition + ExpandedProperties *ExpandedProperties `json:"expandedProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleEligibilityScheduleRequestProperties. +func (resrp RoleEligibilityScheduleRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if resrp.RoleDefinitionID != nil { + objectMap["roleDefinitionId"] = resrp.RoleDefinitionID + } + if resrp.PrincipalID != nil { + objectMap["principalId"] = resrp.PrincipalID + } + if resrp.RequestType != "" { + objectMap["requestType"] = resrp.RequestType + } + if resrp.ScheduleInfo != nil { + objectMap["scheduleInfo"] = resrp.ScheduleInfo + } + if resrp.TargetRoleEligibilityScheduleID != nil { + objectMap["targetRoleEligibilityScheduleId"] = resrp.TargetRoleEligibilityScheduleID + } + if resrp.TargetRoleEligibilityScheduleInstanceID != nil { + objectMap["targetRoleEligibilityScheduleInstanceId"] = resrp.TargetRoleEligibilityScheduleInstanceID + } + if resrp.Justification != nil { + objectMap["justification"] = resrp.Justification + } + if resrp.TicketInfo != nil { + objectMap["ticketInfo"] = resrp.TicketInfo + } + if resrp.Condition != nil { + objectMap["condition"] = resrp.Condition + } + if resrp.ConditionVersion != nil { + objectMap["conditionVersion"] = resrp.ConditionVersion + } + return json.Marshal(objectMap) +} + +// RoleEligibilityScheduleRequestPropertiesScheduleInfo schedule info of the role eligibility schedule +type RoleEligibilityScheduleRequestPropertiesScheduleInfo struct { + // StartDateTime - Start DateTime of the role eligibility schedule. + StartDateTime *date.Time `json:"startDateTime,omitempty"` + // Expiration - Expiration of the role eligibility schedule + Expiration *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration `json:"expiration,omitempty"` +} + +// RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration expiration of the role eligibility +// schedule +type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration struct { + // Type - Type of the role eligibility schedule expiration. Possible values include: 'AfterDuration', 'AfterDateTime', 'NoExpiration' + Type Type `json:"type,omitempty"` + // EndDateTime - End DateTime of the role eligibility schedule. + EndDateTime *date.Time `json:"endDateTime,omitempty"` + // Duration - Duration of the role eligibility schedule in TimeSpan. + Duration *string `json:"duration,omitempty"` +} + +// RoleEligibilityScheduleRequestPropertiesTicketInfo ticket Info of the role eligibility +type RoleEligibilityScheduleRequestPropertiesTicketInfo struct { + // TicketNumber - Ticket number for the role eligibility + TicketNumber *string `json:"ticketNumber,omitempty"` + // TicketSystem - Ticket system name for the role eligibility + TicketSystem *string `json:"ticketSystem,omitempty"` +} + +// RoleManagementPolicy role management policy +type RoleManagementPolicy struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role management policy Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role management policy name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role management policy type. + Type *string `json:"type,omitempty"` + // RoleManagementPolicyProperties - Role management policy properties. + *RoleManagementPolicyProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicy. +func (rmp RoleManagementPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmp.RoleManagementPolicyProperties != nil { + objectMap["properties"] = rmp.RoleManagementPolicyProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleManagementPolicy struct. +func (rmp *RoleManagementPolicy) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rmp.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rmp.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rmp.Type = &typeVar + } + case "properties": + if v != nil { + var roleManagementPolicyProperties RoleManagementPolicyProperties + err = json.Unmarshal(*v, &roleManagementPolicyProperties) + if err != nil { + return err + } + rmp.RoleManagementPolicyProperties = &roleManagementPolicyProperties + } + } + } + + return nil +} + +// RoleManagementPolicyApprovalRule the role management policy rule. +type RoleManagementPolicyApprovalRule struct { + // Setting - The approval setting + Setting *ApprovalSettings `json:"setting,omitempty"` + // ID - The id of the rule. + ID *string `json:"id,omitempty"` + // Target - The target of the current rule. + Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // RuleType - Possible values include: 'RuleTypeRoleManagementPolicyRule', 'RuleTypeRoleManagementPolicyApprovalRule', 'RuleTypeRoleManagementPolicyAuthenticationContextRule', 'RuleTypeRoleManagementPolicyEnablementRule', 'RuleTypeRoleManagementPolicyExpirationRule', 'RuleTypeRoleManagementPolicyNotificationRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) MarshalJSON() ([]byte, error) { + rmpar.RuleType = RuleTypeRoleManagementPolicyApprovalRule + objectMap := make(map[string]interface{}) + if rmpar.Setting != nil { + objectMap["setting"] = rmpar.Setting + } + if rmpar.ID != nil { + objectMap["id"] = rmpar.ID + } + if rmpar.Target != nil { + objectMap["target"] = rmpar.Target + } + if rmpar.RuleType != "" { + objectMap["ruleType"] = rmpar.RuleType + } + return json.Marshal(objectMap) +} + +// AsRoleManagementPolicyApprovalRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) AsRoleManagementPolicyApprovalRule() (*RoleManagementPolicyApprovalRule, bool) { + return &rmpar, true +} + +// AsRoleManagementPolicyAuthenticationContextRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) AsRoleManagementPolicyAuthenticationContextRule() (*RoleManagementPolicyAuthenticationContextRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyEnablementRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) AsRoleManagementPolicyEnablementRule() (*RoleManagementPolicyEnablementRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyExpirationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) AsRoleManagementPolicyExpirationRule() (*RoleManagementPolicyExpirationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyNotificationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) AsRoleManagementPolicyNotificationRule() (*RoleManagementPolicyNotificationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) AsRoleManagementPolicyRule() (*RoleManagementPolicyRule, bool) { + return nil, false +} + +// AsBasicRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyApprovalRule. +func (rmpar RoleManagementPolicyApprovalRule) AsBasicRoleManagementPolicyRule() (BasicRoleManagementPolicyRule, bool) { + return &rmpar, true +} + +// RoleManagementPolicyAssignment role management policy +type RoleManagementPolicyAssignment struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The role management policy Id. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The role management policy name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The role management policy type. + Type *string `json:"type,omitempty"` + // RoleManagementPolicyAssignmentProperties - Role management policy properties. + *RoleManagementPolicyAssignmentProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyAssignment. +func (rmpa RoleManagementPolicyAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmpa.RoleManagementPolicyAssignmentProperties != nil { + objectMap["properties"] = rmpa.RoleManagementPolicyAssignmentProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleManagementPolicyAssignment struct. +func (rmpa *RoleManagementPolicyAssignment) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rmpa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rmpa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rmpa.Type = &typeVar + } + case "properties": + if v != nil { + var roleManagementPolicyAssignmentProperties RoleManagementPolicyAssignmentProperties + err = json.Unmarshal(*v, &roleManagementPolicyAssignmentProperties) + if err != nil { + return err + } + rmpa.RoleManagementPolicyAssignmentProperties = &roleManagementPolicyAssignmentProperties + } + } + } + + return nil +} + +// RoleManagementPolicyAssignmentListResult role management policy assignment list operation result. +type RoleManagementPolicyAssignmentListResult struct { + autorest.Response `json:"-"` + // Value - Role management policy assignment list. + Value *[]RoleManagementPolicyAssignment `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleManagementPolicyAssignmentListResultIterator provides access to a complete listing of +// RoleManagementPolicyAssignment values. +type RoleManagementPolicyAssignmentListResultIterator struct { + i int + page RoleManagementPolicyAssignmentListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleManagementPolicyAssignmentListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyAssignmentListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleManagementPolicyAssignmentListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleManagementPolicyAssignmentListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleManagementPolicyAssignmentListResultIterator) Response() RoleManagementPolicyAssignmentListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleManagementPolicyAssignmentListResultIterator) Value() RoleManagementPolicyAssignment { + if !iter.page.NotDone() { + return RoleManagementPolicyAssignment{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleManagementPolicyAssignmentListResultIterator type. +func NewRoleManagementPolicyAssignmentListResultIterator(page RoleManagementPolicyAssignmentListResultPage) RoleManagementPolicyAssignmentListResultIterator { + return RoleManagementPolicyAssignmentListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rmpalr RoleManagementPolicyAssignmentListResult) IsEmpty() bool { + return rmpalr.Value == nil || len(*rmpalr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rmpalr RoleManagementPolicyAssignmentListResult) hasNextLink() bool { + return rmpalr.NextLink != nil && len(*rmpalr.NextLink) != 0 +} + +// roleManagementPolicyAssignmentListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rmpalr RoleManagementPolicyAssignmentListResult) roleManagementPolicyAssignmentListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rmpalr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rmpalr.NextLink))) +} + +// RoleManagementPolicyAssignmentListResultPage contains a page of RoleManagementPolicyAssignment values. +type RoleManagementPolicyAssignmentListResultPage struct { + fn func(context.Context, RoleManagementPolicyAssignmentListResult) (RoleManagementPolicyAssignmentListResult, error) + rmpalr RoleManagementPolicyAssignmentListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleManagementPolicyAssignmentListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyAssignmentListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rmpalr) + if err != nil { + return err + } + page.rmpalr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleManagementPolicyAssignmentListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleManagementPolicyAssignmentListResultPage) NotDone() bool { + return !page.rmpalr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleManagementPolicyAssignmentListResultPage) Response() RoleManagementPolicyAssignmentListResult { + return page.rmpalr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleManagementPolicyAssignmentListResultPage) Values() []RoleManagementPolicyAssignment { + if page.rmpalr.IsEmpty() { + return nil + } + return *page.rmpalr.Value +} + +// Creates a new instance of the RoleManagementPolicyAssignmentListResultPage type. +func NewRoleManagementPolicyAssignmentListResultPage(cur RoleManagementPolicyAssignmentListResult, getNextPage func(context.Context, RoleManagementPolicyAssignmentListResult) (RoleManagementPolicyAssignmentListResult, error)) RoleManagementPolicyAssignmentListResultPage { + return RoleManagementPolicyAssignmentListResultPage{ + fn: getNextPage, + rmpalr: cur, + } +} + +// RoleManagementPolicyAssignmentProperties role management policy assignment properties with scope. +type RoleManagementPolicyAssignmentProperties struct { + // Scope - The role management policy scope. + Scope *string `json:"scope,omitempty"` + // RoleDefinitionID - The role definition of management policy assignment. + RoleDefinitionID *string `json:"roleDefinitionId,omitempty"` + // PolicyID - The policy id role management policy assignment. + PolicyID *string `json:"policyId,omitempty"` + // PolicyAssignmentProperties - READ-ONLY; Additional properties of scope, role definition and policy + PolicyAssignmentProperties *PolicyAssignmentProperties `json:"policyAssignmentProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyAssignmentProperties. +func (rmpap RoleManagementPolicyAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmpap.Scope != nil { + objectMap["scope"] = rmpap.Scope + } + if rmpap.RoleDefinitionID != nil { + objectMap["roleDefinitionId"] = rmpap.RoleDefinitionID + } + if rmpap.PolicyID != nil { + objectMap["policyId"] = rmpap.PolicyID + } + return json.Marshal(objectMap) +} + +// RoleManagementPolicyAuthenticationContextRule the role management policy rule. +type RoleManagementPolicyAuthenticationContextRule struct { + // IsEnabled - The value indicating if rule is enabled. + IsEnabled *bool `json:"isEnabled,omitempty"` + // ClaimValue - The claim value. + ClaimValue *string `json:"claimValue,omitempty"` + // ID - The id of the rule. + ID *string `json:"id,omitempty"` + // Target - The target of the current rule. + Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // RuleType - Possible values include: 'RuleTypeRoleManagementPolicyRule', 'RuleTypeRoleManagementPolicyApprovalRule', 'RuleTypeRoleManagementPolicyAuthenticationContextRule', 'RuleTypeRoleManagementPolicyEnablementRule', 'RuleTypeRoleManagementPolicyExpirationRule', 'RuleTypeRoleManagementPolicyNotificationRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) MarshalJSON() ([]byte, error) { + rmpacr.RuleType = RuleTypeRoleManagementPolicyAuthenticationContextRule + objectMap := make(map[string]interface{}) + if rmpacr.IsEnabled != nil { + objectMap["isEnabled"] = rmpacr.IsEnabled + } + if rmpacr.ClaimValue != nil { + objectMap["claimValue"] = rmpacr.ClaimValue + } + if rmpacr.ID != nil { + objectMap["id"] = rmpacr.ID + } + if rmpacr.Target != nil { + objectMap["target"] = rmpacr.Target + } + if rmpacr.RuleType != "" { + objectMap["ruleType"] = rmpacr.RuleType + } + return json.Marshal(objectMap) +} + +// AsRoleManagementPolicyApprovalRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) AsRoleManagementPolicyApprovalRule() (*RoleManagementPolicyApprovalRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyAuthenticationContextRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) AsRoleManagementPolicyAuthenticationContextRule() (*RoleManagementPolicyAuthenticationContextRule, bool) { + return &rmpacr, true +} + +// AsRoleManagementPolicyEnablementRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) AsRoleManagementPolicyEnablementRule() (*RoleManagementPolicyEnablementRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyExpirationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) AsRoleManagementPolicyExpirationRule() (*RoleManagementPolicyExpirationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyNotificationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) AsRoleManagementPolicyNotificationRule() (*RoleManagementPolicyNotificationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) AsRoleManagementPolicyRule() (*RoleManagementPolicyRule, bool) { + return nil, false +} + +// AsBasicRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyAuthenticationContextRule. +func (rmpacr RoleManagementPolicyAuthenticationContextRule) AsBasicRoleManagementPolicyRule() (BasicRoleManagementPolicyRule, bool) { + return &rmpacr, true +} + +// RoleManagementPolicyEnablementRule the role management policy rule. +type RoleManagementPolicyEnablementRule struct { + // EnabledRules - The list of enabled rules. + EnabledRules *[]EnablementRules `json:"enabledRules,omitempty"` + // ID - The id of the rule. + ID *string `json:"id,omitempty"` + // Target - The target of the current rule. + Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // RuleType - Possible values include: 'RuleTypeRoleManagementPolicyRule', 'RuleTypeRoleManagementPolicyApprovalRule', 'RuleTypeRoleManagementPolicyAuthenticationContextRule', 'RuleTypeRoleManagementPolicyEnablementRule', 'RuleTypeRoleManagementPolicyExpirationRule', 'RuleTypeRoleManagementPolicyNotificationRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) MarshalJSON() ([]byte, error) { + rmper.RuleType = RuleTypeRoleManagementPolicyEnablementRule + objectMap := make(map[string]interface{}) + if rmper.EnabledRules != nil { + objectMap["enabledRules"] = rmper.EnabledRules + } + if rmper.ID != nil { + objectMap["id"] = rmper.ID + } + if rmper.Target != nil { + objectMap["target"] = rmper.Target + } + if rmper.RuleType != "" { + objectMap["ruleType"] = rmper.RuleType + } + return json.Marshal(objectMap) +} + +// AsRoleManagementPolicyApprovalRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) AsRoleManagementPolicyApprovalRule() (*RoleManagementPolicyApprovalRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyAuthenticationContextRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) AsRoleManagementPolicyAuthenticationContextRule() (*RoleManagementPolicyAuthenticationContextRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyEnablementRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) AsRoleManagementPolicyEnablementRule() (*RoleManagementPolicyEnablementRule, bool) { + return &rmper, true +} + +// AsRoleManagementPolicyExpirationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) AsRoleManagementPolicyExpirationRule() (*RoleManagementPolicyExpirationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyNotificationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) AsRoleManagementPolicyNotificationRule() (*RoleManagementPolicyNotificationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) AsRoleManagementPolicyRule() (*RoleManagementPolicyRule, bool) { + return nil, false +} + +// AsBasicRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyEnablementRule. +func (rmper RoleManagementPolicyEnablementRule) AsBasicRoleManagementPolicyRule() (BasicRoleManagementPolicyRule, bool) { + return &rmper, true +} + +// RoleManagementPolicyExpirationRule the role management policy rule. +type RoleManagementPolicyExpirationRule struct { + // IsExpirationRequired - The value indicating whether expiration is required. + IsExpirationRequired *bool `json:"isExpirationRequired,omitempty"` + // MaximumDuration - The maximum duration of expiration in timespan. + MaximumDuration *string `json:"maximumDuration,omitempty"` + // ID - The id of the rule. + ID *string `json:"id,omitempty"` + // Target - The target of the current rule. + Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // RuleType - Possible values include: 'RuleTypeRoleManagementPolicyRule', 'RuleTypeRoleManagementPolicyApprovalRule', 'RuleTypeRoleManagementPolicyAuthenticationContextRule', 'RuleTypeRoleManagementPolicyEnablementRule', 'RuleTypeRoleManagementPolicyExpirationRule', 'RuleTypeRoleManagementPolicyNotificationRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) MarshalJSON() ([]byte, error) { + rmper.RuleType = RuleTypeRoleManagementPolicyExpirationRule + objectMap := make(map[string]interface{}) + if rmper.IsExpirationRequired != nil { + objectMap["isExpirationRequired"] = rmper.IsExpirationRequired + } + if rmper.MaximumDuration != nil { + objectMap["maximumDuration"] = rmper.MaximumDuration + } + if rmper.ID != nil { + objectMap["id"] = rmper.ID + } + if rmper.Target != nil { + objectMap["target"] = rmper.Target + } + if rmper.RuleType != "" { + objectMap["ruleType"] = rmper.RuleType + } + return json.Marshal(objectMap) +} + +// AsRoleManagementPolicyApprovalRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) AsRoleManagementPolicyApprovalRule() (*RoleManagementPolicyApprovalRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyAuthenticationContextRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) AsRoleManagementPolicyAuthenticationContextRule() (*RoleManagementPolicyAuthenticationContextRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyEnablementRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) AsRoleManagementPolicyEnablementRule() (*RoleManagementPolicyEnablementRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyExpirationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) AsRoleManagementPolicyExpirationRule() (*RoleManagementPolicyExpirationRule, bool) { + return &rmper, true +} + +// AsRoleManagementPolicyNotificationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) AsRoleManagementPolicyNotificationRule() (*RoleManagementPolicyNotificationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) AsRoleManagementPolicyRule() (*RoleManagementPolicyRule, bool) { + return nil, false +} + +// AsBasicRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyExpirationRule. +func (rmper RoleManagementPolicyExpirationRule) AsBasicRoleManagementPolicyRule() (BasicRoleManagementPolicyRule, bool) { + return &rmper, true +} + +// RoleManagementPolicyListResult role management policy list operation result. +type RoleManagementPolicyListResult struct { + autorest.Response `json:"-"` + // Value - Role management policy list. + Value *[]RoleManagementPolicy `json:"value,omitempty"` + // NextLink - The URL to use for getting the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// RoleManagementPolicyListResultIterator provides access to a complete listing of RoleManagementPolicy +// values. +type RoleManagementPolicyListResultIterator struct { + i int + page RoleManagementPolicyListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleManagementPolicyListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleManagementPolicyListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleManagementPolicyListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleManagementPolicyListResultIterator) Response() RoleManagementPolicyListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleManagementPolicyListResultIterator) Value() RoleManagementPolicy { + if !iter.page.NotDone() { + return RoleManagementPolicy{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleManagementPolicyListResultIterator type. +func NewRoleManagementPolicyListResultIterator(page RoleManagementPolicyListResultPage) RoleManagementPolicyListResultIterator { + return RoleManagementPolicyListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rmplr RoleManagementPolicyListResult) IsEmpty() bool { + return rmplr.Value == nil || len(*rmplr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rmplr RoleManagementPolicyListResult) hasNextLink() bool { + return rmplr.NextLink != nil && len(*rmplr.NextLink) != 0 +} + +// roleManagementPolicyListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rmplr RoleManagementPolicyListResult) roleManagementPolicyListResultPreparer(ctx context.Context) (*http.Request, error) { + if !rmplr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rmplr.NextLink))) +} + +// RoleManagementPolicyListResultPage contains a page of RoleManagementPolicy values. +type RoleManagementPolicyListResultPage struct { + fn func(context.Context, RoleManagementPolicyListResult) (RoleManagementPolicyListResult, error) + rmplr RoleManagementPolicyListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleManagementPolicyListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rmplr) + if err != nil { + return err + } + page.rmplr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleManagementPolicyListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleManagementPolicyListResultPage) NotDone() bool { + return !page.rmplr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleManagementPolicyListResultPage) Response() RoleManagementPolicyListResult { + return page.rmplr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleManagementPolicyListResultPage) Values() []RoleManagementPolicy { + if page.rmplr.IsEmpty() { + return nil + } + return *page.rmplr.Value +} + +// Creates a new instance of the RoleManagementPolicyListResultPage type. +func NewRoleManagementPolicyListResultPage(cur RoleManagementPolicyListResult, getNextPage func(context.Context, RoleManagementPolicyListResult) (RoleManagementPolicyListResult, error)) RoleManagementPolicyListResultPage { + return RoleManagementPolicyListResultPage{ + fn: getNextPage, + rmplr: cur, + } +} + +// RoleManagementPolicyNotificationRule the role management policy rule. +type RoleManagementPolicyNotificationRule struct { + // NotificationType - The type of notification. Possible values include: 'Email' + NotificationType NotificationDeliveryMechanism `json:"notificationType,omitempty"` + // NotificationLevel - The notification level. Possible values include: 'None', 'Critical', 'All' + NotificationLevel NotificationLevel `json:"notificationLevel,omitempty"` + // RecipientType - The recipient type. Possible values include: 'Requestor', 'Approver', 'Admin' + RecipientType RecipientType `json:"recipientType,omitempty"` + // NotificationRecipients - The list notification recipients. + NotificationRecipients *[]string `json:"notificationRecipients,omitempty"` + // IsDefaultRecipientsEnabled - Its value determine if the notification need to be sent to the recipient type specified in policy rule. + IsDefaultRecipientsEnabled *bool `json:"isDefaultRecipientsEnabled,omitempty"` + // ID - The id of the rule. + ID *string `json:"id,omitempty"` + // Target - The target of the current rule. + Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // RuleType - Possible values include: 'RuleTypeRoleManagementPolicyRule', 'RuleTypeRoleManagementPolicyApprovalRule', 'RuleTypeRoleManagementPolicyAuthenticationContextRule', 'RuleTypeRoleManagementPolicyEnablementRule', 'RuleTypeRoleManagementPolicyExpirationRule', 'RuleTypeRoleManagementPolicyNotificationRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) MarshalJSON() ([]byte, error) { + rmpnr.RuleType = RuleTypeRoleManagementPolicyNotificationRule + objectMap := make(map[string]interface{}) + if rmpnr.NotificationType != "" { + objectMap["notificationType"] = rmpnr.NotificationType + } + if rmpnr.NotificationLevel != "" { + objectMap["notificationLevel"] = rmpnr.NotificationLevel + } + if rmpnr.RecipientType != "" { + objectMap["recipientType"] = rmpnr.RecipientType + } + if rmpnr.NotificationRecipients != nil { + objectMap["notificationRecipients"] = rmpnr.NotificationRecipients + } + if rmpnr.IsDefaultRecipientsEnabled != nil { + objectMap["isDefaultRecipientsEnabled"] = rmpnr.IsDefaultRecipientsEnabled + } + if rmpnr.ID != nil { + objectMap["id"] = rmpnr.ID + } + if rmpnr.Target != nil { + objectMap["target"] = rmpnr.Target + } + if rmpnr.RuleType != "" { + objectMap["ruleType"] = rmpnr.RuleType + } + return json.Marshal(objectMap) +} + +// AsRoleManagementPolicyApprovalRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) AsRoleManagementPolicyApprovalRule() (*RoleManagementPolicyApprovalRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyAuthenticationContextRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) AsRoleManagementPolicyAuthenticationContextRule() (*RoleManagementPolicyAuthenticationContextRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyEnablementRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) AsRoleManagementPolicyEnablementRule() (*RoleManagementPolicyEnablementRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyExpirationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) AsRoleManagementPolicyExpirationRule() (*RoleManagementPolicyExpirationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyNotificationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) AsRoleManagementPolicyNotificationRule() (*RoleManagementPolicyNotificationRule, bool) { + return &rmpnr, true +} + +// AsRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) AsRoleManagementPolicyRule() (*RoleManagementPolicyRule, bool) { + return nil, false +} + +// AsBasicRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyNotificationRule. +func (rmpnr RoleManagementPolicyNotificationRule) AsBasicRoleManagementPolicyRule() (BasicRoleManagementPolicyRule, bool) { + return &rmpnr, true +} + +// RoleManagementPolicyProperties role management policy properties with scope. +type RoleManagementPolicyProperties struct { + // Scope - The role management policy scope. + Scope *string `json:"scope,omitempty"` + // DisplayName - The role management policy display name. + DisplayName *string `json:"displayName,omitempty"` + // Description - The role management policy description. + Description *string `json:"description,omitempty"` + // IsOrganizationDefault - The role management policy is default policy. + IsOrganizationDefault *bool `json:"isOrganizationDefault,omitempty"` + LastModifiedBy *Principal `json:"lastModifiedBy,omitempty"` + // LastModifiedDateTime - READ-ONLY; The last modified date time. + LastModifiedDateTime *date.Time `json:"lastModifiedDateTime,omitempty"` + // Rules - The rule applied to the policy. + Rules *[]BasicRoleManagementPolicyRule `json:"rules,omitempty"` + // EffectiveRules - READ-ONLY; The readonly computed rule applied to the policy. + EffectiveRules *[]BasicRoleManagementPolicyRule `json:"effectiveRules,omitempty"` + // PolicyProperties - READ-ONLY; Additional properties of scope + PolicyProperties *PolicyProperties `json:"policyProperties,omitempty"` +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyProperties. +func (rmpp RoleManagementPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmpp.Scope != nil { + objectMap["scope"] = rmpp.Scope + } + if rmpp.DisplayName != nil { + objectMap["displayName"] = rmpp.DisplayName + } + if rmpp.Description != nil { + objectMap["description"] = rmpp.Description + } + if rmpp.IsOrganizationDefault != nil { + objectMap["isOrganizationDefault"] = rmpp.IsOrganizationDefault + } + if rmpp.LastModifiedBy != nil { + objectMap["lastModifiedBy"] = rmpp.LastModifiedBy + } + if rmpp.Rules != nil { + objectMap["rules"] = rmpp.Rules + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RoleManagementPolicyProperties struct. +func (rmpp *RoleManagementPolicyProperties) 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 "scope": + if v != nil { + var scope string + err = json.Unmarshal(*v, &scope) + if err != nil { + return err + } + rmpp.Scope = &scope + } + case "displayName": + if v != nil { + var displayName string + err = json.Unmarshal(*v, &displayName) + if err != nil { + return err + } + rmpp.DisplayName = &displayName + } + case "description": + if v != nil { + var description string + err = json.Unmarshal(*v, &description) + if err != nil { + return err + } + rmpp.Description = &description + } + case "isOrganizationDefault": + if v != nil { + var isOrganizationDefault bool + err = json.Unmarshal(*v, &isOrganizationDefault) + if err != nil { + return err + } + rmpp.IsOrganizationDefault = &isOrganizationDefault + } + case "lastModifiedBy": + if v != nil { + var lastModifiedBy Principal + err = json.Unmarshal(*v, &lastModifiedBy) + if err != nil { + return err + } + rmpp.LastModifiedBy = &lastModifiedBy + } + case "lastModifiedDateTime": + if v != nil { + var lastModifiedDateTime date.Time + err = json.Unmarshal(*v, &lastModifiedDateTime) + if err != nil { + return err + } + rmpp.LastModifiedDateTime = &lastModifiedDateTime + } + case "rules": + if v != nil { + rules, err := unmarshalBasicRoleManagementPolicyRuleArray(*v) + if err != nil { + return err + } + rmpp.Rules = &rules + } + case "effectiveRules": + if v != nil { + effectiveRules, err := unmarshalBasicRoleManagementPolicyRuleArray(*v) + if err != nil { + return err + } + rmpp.EffectiveRules = &effectiveRules + } + case "policyProperties": + if v != nil { + var policyProperties PolicyProperties + err = json.Unmarshal(*v, &policyProperties) + if err != nil { + return err + } + rmpp.PolicyProperties = &policyProperties + } + } + } + + return nil +} + +// BasicRoleManagementPolicyRule the role management policy rule. +type BasicRoleManagementPolicyRule interface { + AsRoleManagementPolicyApprovalRule() (*RoleManagementPolicyApprovalRule, bool) + AsRoleManagementPolicyAuthenticationContextRule() (*RoleManagementPolicyAuthenticationContextRule, bool) + AsRoleManagementPolicyEnablementRule() (*RoleManagementPolicyEnablementRule, bool) + AsRoleManagementPolicyExpirationRule() (*RoleManagementPolicyExpirationRule, bool) + AsRoleManagementPolicyNotificationRule() (*RoleManagementPolicyNotificationRule, bool) + AsRoleManagementPolicyRule() (*RoleManagementPolicyRule, bool) +} + +// RoleManagementPolicyRule the role management policy rule. +type RoleManagementPolicyRule struct { + // ID - The id of the rule. + ID *string `json:"id,omitempty"` + // Target - The target of the current rule. + Target *RoleManagementPolicyRuleTarget `json:"target,omitempty"` + // RuleType - Possible values include: 'RuleTypeRoleManagementPolicyRule', 'RuleTypeRoleManagementPolicyApprovalRule', 'RuleTypeRoleManagementPolicyAuthenticationContextRule', 'RuleTypeRoleManagementPolicyEnablementRule', 'RuleTypeRoleManagementPolicyExpirationRule', 'RuleTypeRoleManagementPolicyNotificationRule' + RuleType RuleType `json:"ruleType,omitempty"` +} + +func unmarshalBasicRoleManagementPolicyRule(body []byte) (BasicRoleManagementPolicyRule, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["ruleType"] { + case string(RuleTypeRoleManagementPolicyApprovalRule): + var rmpar RoleManagementPolicyApprovalRule + err := json.Unmarshal(body, &rmpar) + return rmpar, err + case string(RuleTypeRoleManagementPolicyAuthenticationContextRule): + var rmpacr RoleManagementPolicyAuthenticationContextRule + err := json.Unmarshal(body, &rmpacr) + return rmpacr, err + case string(RuleTypeRoleManagementPolicyEnablementRule): + var rmper RoleManagementPolicyEnablementRule + err := json.Unmarshal(body, &rmper) + return rmper, err + case string(RuleTypeRoleManagementPolicyExpirationRule): + var rmper RoleManagementPolicyExpirationRule + err := json.Unmarshal(body, &rmper) + return rmper, err + case string(RuleTypeRoleManagementPolicyNotificationRule): + var rmpnr RoleManagementPolicyNotificationRule + err := json.Unmarshal(body, &rmpnr) + return rmpnr, err + default: + var rmpr RoleManagementPolicyRule + err := json.Unmarshal(body, &rmpr) + return rmpr, err + } +} +func unmarshalBasicRoleManagementPolicyRuleArray(body []byte) ([]BasicRoleManagementPolicyRule, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rmprArray := make([]BasicRoleManagementPolicyRule, len(rawMessages)) + + for index, rawMessage := range rawMessages { + rmpr, err := unmarshalBasicRoleManagementPolicyRule(*rawMessage) + if err != nil { + return nil, err + } + rmprArray[index] = rmpr + } + return rmprArray, nil +} + +// MarshalJSON is the custom marshaler for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) MarshalJSON() ([]byte, error) { + rmpr.RuleType = RuleTypeRoleManagementPolicyRule + objectMap := make(map[string]interface{}) + if rmpr.ID != nil { + objectMap["id"] = rmpr.ID + } + if rmpr.Target != nil { + objectMap["target"] = rmpr.Target + } + if rmpr.RuleType != "" { + objectMap["ruleType"] = rmpr.RuleType + } + return json.Marshal(objectMap) +} + +// AsRoleManagementPolicyApprovalRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) AsRoleManagementPolicyApprovalRule() (*RoleManagementPolicyApprovalRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyAuthenticationContextRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) AsRoleManagementPolicyAuthenticationContextRule() (*RoleManagementPolicyAuthenticationContextRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyEnablementRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) AsRoleManagementPolicyEnablementRule() (*RoleManagementPolicyEnablementRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyExpirationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) AsRoleManagementPolicyExpirationRule() (*RoleManagementPolicyExpirationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyNotificationRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) AsRoleManagementPolicyNotificationRule() (*RoleManagementPolicyNotificationRule, bool) { + return nil, false +} + +// AsRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) AsRoleManagementPolicyRule() (*RoleManagementPolicyRule, bool) { + return &rmpr, true +} + +// AsBasicRoleManagementPolicyRule is the BasicRoleManagementPolicyRule implementation for RoleManagementPolicyRule. +func (rmpr RoleManagementPolicyRule) AsBasicRoleManagementPolicyRule() (BasicRoleManagementPolicyRule, bool) { + return &rmpr, true +} + +// RoleManagementPolicyRuleTarget the role management policy rule target. +type RoleManagementPolicyRuleTarget struct { + // Caller - The caller of the setting. + Caller *string `json:"caller,omitempty"` + // Operations - The type of operation. + Operations *[]string `json:"operations,omitempty"` + // Level - The assignment level to which it is applied. + Level *string `json:"level,omitempty"` + // TargetObjects - The list of target objects. + TargetObjects *[]string `json:"targetObjects,omitempty"` + // InheritableSettings - The list of inheritable settings. + InheritableSettings *[]string `json:"inheritableSettings,omitempty"` + // EnforcedSettings - The list of enforced settings. + EnforcedSettings *[]string `json:"enforcedSettings,omitempty"` +} + +// ServicePrincipalDecisionTarget service Principal Decision Target +type ServicePrincipalDecisionTarget struct { + // PrincipalID - READ-ONLY; The id of service principal whose access is reviewed. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalName - READ-ONLY; The display name of the service principal whose access was reviewed. + PrincipalName *string `json:"principalName,omitempty"` + // AppID - READ-ONLY; The appId for the service principal entity being reviewed + AppID *string `json:"appId,omitempty"` + // Type - Possible values include: 'TypeAccessReviewDecisionTarget', 'TypeUser', 'TypeServicePrincipal' + Type TypeBasicAccessReviewDecisionTarget `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServicePrincipalDecisionTarget. +func (spdt ServicePrincipalDecisionTarget) MarshalJSON() ([]byte, error) { + spdt.Type = TypeServicePrincipal + objectMap := make(map[string]interface{}) + if spdt.Type != "" { + objectMap["type"] = spdt.Type + } + return json.Marshal(objectMap) +} + +// AsUserDecisionTarget is the BasicAccessReviewDecisionTarget implementation for ServicePrincipalDecisionTarget. +func (spdt ServicePrincipalDecisionTarget) AsUserDecisionTarget() (*UserDecisionTarget, bool) { + return nil, false +} + +// AsServicePrincipalDecisionTarget is the BasicAccessReviewDecisionTarget implementation for ServicePrincipalDecisionTarget. +func (spdt ServicePrincipalDecisionTarget) AsServicePrincipalDecisionTarget() (*ServicePrincipalDecisionTarget, bool) { + return &spdt, true +} + +// AsAccessReviewDecisionTarget is the BasicAccessReviewDecisionTarget implementation for ServicePrincipalDecisionTarget. +func (spdt ServicePrincipalDecisionTarget) AsAccessReviewDecisionTarget() (*AccessReviewDecisionTarget, bool) { + return nil, false +} + +// AsBasicAccessReviewDecisionTarget is the BasicAccessReviewDecisionTarget implementation for ServicePrincipalDecisionTarget. +func (spdt ServicePrincipalDecisionTarget) AsBasicAccessReviewDecisionTarget() (BasicAccessReviewDecisionTarget, bool) { + return &spdt, true +} + +// UserDecisionTarget user Decision Target +type UserDecisionTarget struct { + // PrincipalID - READ-ONLY; The id of user whose access was reviewed. + PrincipalID *string `json:"principalId,omitempty"` + // PrincipalName - READ-ONLY; The display name of the user whose access was reviewed. + PrincipalName *string `json:"principalName,omitempty"` + // UserPrincipalName - READ-ONLY; The user principal name of the user whose access was reviewed. + UserPrincipalName *string `json:"userPrincipalName,omitempty"` + // Type - Possible values include: 'TypeAccessReviewDecisionTarget', 'TypeUser', 'TypeServicePrincipal' + Type TypeBasicAccessReviewDecisionTarget `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserDecisionTarget. +func (udt UserDecisionTarget) MarshalJSON() ([]byte, error) { + udt.Type = TypeUser + objectMap := make(map[string]interface{}) + if udt.Type != "" { + objectMap["type"] = udt.Type + } + return json.Marshal(objectMap) +} + +// AsUserDecisionTarget is the BasicAccessReviewDecisionTarget implementation for UserDecisionTarget. +func (udt UserDecisionTarget) AsUserDecisionTarget() (*UserDecisionTarget, bool) { + return &udt, true +} + +// AsServicePrincipalDecisionTarget is the BasicAccessReviewDecisionTarget implementation for UserDecisionTarget. +func (udt UserDecisionTarget) AsServicePrincipalDecisionTarget() (*ServicePrincipalDecisionTarget, bool) { + return nil, false +} + +// AsAccessReviewDecisionTarget is the BasicAccessReviewDecisionTarget implementation for UserDecisionTarget. +func (udt UserDecisionTarget) AsAccessReviewDecisionTarget() (*AccessReviewDecisionTarget, bool) { + return nil, false +} + +// AsBasicAccessReviewDecisionTarget is the BasicAccessReviewDecisionTarget implementation for UserDecisionTarget. +func (udt UserDecisionTarget) AsBasicAccessReviewDecisionTarget() (BasicAccessReviewDecisionTarget, bool) { + return &udt, true +} + +// UserSet the detail of a user. +type UserSet struct { + // UserType - The type of user. Possible values include: 'UserTypeUser', 'UserTypeGroup' + UserType UserType `json:"userType,omitempty"` + // IsBackup - The value indicating whether the user is a backup fallback approver + IsBackup *bool `json:"isBackup,omitempty"` + // ID - The object id of the user. + ID *string `json:"id,omitempty"` + // Description - The description of the user. + Description *string `json:"description,omitempty"` +} + +// ValidationResponse validation response +type ValidationResponse struct { + autorest.Response `json:"-"` + // IsValid - READ-ONLY; Whether or not validation succeeded + IsValid *bool `json:"isValid,omitempty"` + // ErrorInfo - Failed validation result details + ErrorInfo *ValidationResponseErrorInfo `json:"errorInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidationResponse. +func (vr ValidationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if vr.ErrorInfo != nil { + objectMap["errorInfo"] = vr.ErrorInfo + } + return json.Marshal(objectMap) +} + +// ValidationResponseErrorInfo failed validation result details +type ValidationResponseErrorInfo struct { + // Code - READ-ONLY; Error code indicating why validation failed + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Message indicating why validation failed + Message *string `json:"message,omitempty"` +} + +// MarshalJSON is the custom marshaler for ValidationResponseErrorInfo. +func (vrei ValidationResponseErrorInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/operations.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/operations.go new file mode 100644 index 000000000000..1fcf785b7904 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/operations.go @@ -0,0 +1,140 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// OperationsClient is the client for the Operations methods of the Authorization service. +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the operations available from this provider. +func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.olr.Response.Response != nil { + sc = result.olr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.olr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.olr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.olr.hasNextLink() && result.olr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Authorization/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { + req, err := lastResults.operationListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/permissions.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/permissions.go new file mode 100644 index 000000000000..307f7a567df8 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/permissions.go @@ -0,0 +1,290 @@ +package authorization + +// 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" +) + +// PermissionsClient is the client for the Permissions methods of the Authorization service. +type PermissionsClient struct { + BaseClient +} + +// NewPermissionsClient creates an instance of the PermissionsClient client. +func NewPermissionsClient(subscriptionID string) PermissionsClient { + return NewPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPermissionsClientWithBaseURI creates an instance of the PermissionsClient 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 NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) PermissionsClient { + return PermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListForResource gets all permissions the caller has for a resource. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// parentResourcePath - the parent resource identity. +// resourceType - the resource type of the resource. +// resourceName - the name of the resource to get the permissions for. +func (client PermissionsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result PermissionGetResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResource") + defer func() { + sc := -1 + if result.pgr.Response.Response != nil { + sc = result.pgr.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("authorization.PermissionsClient", "ListForResource", err.Error()) + } + + result.fn = client.listForResourceNextResults + req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.pgr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure sending request") + return + } + + result.pgr, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResource", resp, "Failure responding to request") + return + } + if result.pgr.hasNextLink() && result.pgr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForResourcePreparer prepares the ListForResource request. +func (client PermissionsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "parentResourcePath": parentResourcePath, + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "resourceProviderNamespace": resourceProviderNamespace, + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/permissions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForResourceSender sends the ListForResource request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForResourceResponder handles the response to the ListForResource request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListForResourceResponder(resp *http.Response) (result PermissionGetResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForResourceNextResults retrieves the next set of results, if any. +func (client PermissionsClient) listForResourceNextResults(ctx context.Context, lastResults PermissionGetResult) (result PermissionGetResult, err error) { + req, err := lastResults.permissionGetResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client PermissionsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, parentResourcePath string, resourceType string, resourceName string) (result PermissionGetResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResource") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName) + return +} + +// ListForResourceGroup gets all permissions the caller has for a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +func (client PermissionsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string) (result PermissionGetResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") + defer func() { + sc := -1 + if result.pgr.Response.Response != nil { + sc = result.pgr.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("authorization.PermissionsClient", "ListForResourceGroup", err.Error()) + } + + result.fn = client.listForResourceGroupNextResults + req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.pgr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result.pgr, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "ListForResourceGroup", resp, "Failure responding to request") + return + } + if result.pgr.hasNextLink() && result.pgr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client PermissionsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-01-01-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.Authorization/permissions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListForResourceGroupResponder(resp *http.Response) (result PermissionGetResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForResourceGroupNextResults retrieves the next set of results, if any. +func (client PermissionsClient) listForResourceGroupNextResults(ctx context.Context, lastResults PermissionGetResult) (result PermissionGetResult, err error) { + req, err := lastResults.permissionGetResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.PermissionsClient", "listForResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client PermissionsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string) (result PermissionGetResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListForResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForResourceGroup(ctx, resourceGroupName) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/provideroperationsmetadata.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/provideroperationsmetadata.go new file mode 100644 index 000000000000..77cb8b9768e9 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/provideroperationsmetadata.go @@ -0,0 +1,228 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// ProviderOperationsMetadataClient is the client for the ProviderOperationsMetadata methods of the Authorization +// service. +type ProviderOperationsMetadataClient struct { + BaseClient +} + +// NewProviderOperationsMetadataClient creates an instance of the ProviderOperationsMetadataClient client. +func NewProviderOperationsMetadataClient(subscriptionID string) ProviderOperationsMetadataClient { + return NewProviderOperationsMetadataClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewProviderOperationsMetadataClientWithBaseURI creates an instance of the ProviderOperationsMetadataClient 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 NewProviderOperationsMetadataClientWithBaseURI(baseURI string, subscriptionID string) ProviderOperationsMetadataClient { + return ProviderOperationsMetadataClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets provider operations metadata for the specified resource provider. +// Parameters: +// resourceProviderNamespace - the namespace of the resource provider. +// expand - specifies whether to expand the values. +func (client ProviderOperationsMetadataClient) Get(ctx context.Context, resourceProviderNamespace string, expand string) (result ProviderOperationsMetadata, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceProviderNamespace, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ProviderOperationsMetadataClient) GetPreparer(ctx context.Context, resourceProviderNamespace string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceProviderNamespace": resourceProviderNamespace, + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } else { + queryParameters["$expand"] = autorest.Encode("query", "resourceTypes") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}", 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 ProviderOperationsMetadataClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client ProviderOperationsMetadataClient) GetResponder(resp *http.Response) (result ProviderOperationsMetadata, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets provider operations metadata for all resource providers. +// Parameters: +// expand - specifies whether to expand the values. +func (client ProviderOperationsMetadataClient) List(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") + defer func() { + sc := -1 + if result.pomlr.Response.Response != nil { + sc = result.pomlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.pomlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure sending request") + return + } + + result.pomlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "List", resp, "Failure responding to request") + return + } + if result.pomlr.hasNextLink() && result.pomlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ProviderOperationsMetadataClient) ListPreparer(ctx context.Context, expand string) (*http.Request, error) { + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } else { + queryParameters["$expand"] = autorest.Encode("query", "resourceTypes") + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.Authorization/providerOperations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ProviderOperationsMetadataClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ProviderOperationsMetadataClient) ListResponder(resp *http.Response) (result ProviderOperationsMetadataListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ProviderOperationsMetadataClient) listNextResults(ctx context.Context, lastResults ProviderOperationsMetadataListResult) (result ProviderOperationsMetadataListResult, err error) { + req, err := lastResults.providerOperationsMetadataListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.ProviderOperationsMetadataClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProviderOperationsMetadataClient) ListComplete(ctx context.Context, expand string) (result ProviderOperationsMetadataListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProviderOperationsMetadataClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, expand) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentmetrics.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentmetrics.go new file mode 100644 index 000000000000..5059d51a01e5 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentmetrics.go @@ -0,0 +1,110 @@ +package authorization + +// 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" +) + +// RoleAssignmentMetricsClient is the client for the RoleAssignmentMetrics methods of the Authorization service. +type RoleAssignmentMetricsClient struct { + BaseClient +} + +// NewRoleAssignmentMetricsClient creates an instance of the RoleAssignmentMetricsClient client. +func NewRoleAssignmentMetricsClient(subscriptionID string) RoleAssignmentMetricsClient { + return NewRoleAssignmentMetricsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentMetricsClientWithBaseURI creates an instance of the RoleAssignmentMetricsClient 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 NewRoleAssignmentMetricsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentMetricsClient { + return RoleAssignmentMetricsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetMetricsForSubscription get role assignment usage metrics for a subscription +func (client RoleAssignmentMetricsClient) GetMetricsForSubscription(ctx context.Context) (result RoleAssignmentMetricsResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentMetricsClient.GetMetricsForSubscription") + 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("authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", err.Error()) + } + + req, err := client.GetMetricsForSubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.GetMetricsForSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", resp, "Failure sending request") + return + } + + result, err = client.GetMetricsForSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentMetricsClient", "GetMetricsForSubscription", resp, "Failure responding to request") + return + } + + return +} + +// GetMetricsForSubscriptionPreparer prepares the GetMetricsForSubscription request. +func (client RoleAssignmentMetricsClient) GetMetricsForSubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2019-08-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignmentsUsageMetrics", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMetricsForSubscriptionSender sends the GetMetricsForSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentMetricsClient) GetMetricsForSubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetMetricsForSubscriptionResponder handles the response to the GetMetricsForSubscription request. The method always +// closes the http.Response Body. +func (client RoleAssignmentMetricsClient) GetMetricsForSubscriptionResponder(resp *http.Response) (result RoleAssignmentMetricsResult, 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/authorization/mgmt/2020-10-01-preview/authorization/roleassignments.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignments.go new file mode 100644 index 000000000000..635f176ec700 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignments.go @@ -0,0 +1,1247 @@ +package authorization + +// 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" +) + +// RoleAssignmentsClient is the client for the RoleAssignments methods of the Authorization service. +type RoleAssignmentsClient struct { + BaseClient +} + +// NewRoleAssignmentsClient creates an instance of the RoleAssignmentsClient client. +func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { + return NewRoleAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentsClientWithBaseURI creates an instance of the RoleAssignmentsClient 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 NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { + return RoleAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create or update a role assignment by scope and name. +// Parameters: +// scope - the scope of the operation or resource. Valid scopes are: subscription (format: +// '/subscriptions/{subscriptionId}'), resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// roleAssignmentName - the name of the role assignment. It can be any valid GUID. +// parameters - parameters for the role assignment. +func (client RoleAssignmentsClient) Create(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.Create") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RoleAssignmentProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, scope, roleAssignmentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RoleAssignmentsClient) CreatePreparer(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentName": roleAssignmentName, + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) CreateResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateByID create or update a role assignment by ID. +// Parameters: +// roleAssignmentID - the fully qualified ID of the role assignment including scope, resource name, and +// resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. +// Example: +// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ +// parameters - parameters for the role assignment. +func (client RoleAssignmentsClient) CreateByID(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.CreateByID") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RoleAssignmentProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentsClient", "CreateByID", err.Error()) + } + + req, err := client.CreateByIDPreparer(ctx, roleAssignmentID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", nil, "Failure preparing request") + return + } + + resp, err := client.CreateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure sending request") + return + } + + result, err = client.CreateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "CreateByID", resp, "Failure responding to request") + return + } + + return +} + +// CreateByIDPreparer prepares the CreateByID request. +func (client RoleAssignmentsClient) CreateByIDPreparer(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentId": roleAssignmentID, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateByIDSender sends the CreateByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) CreateByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateByIDResponder handles the response to the CreateByID request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) CreateByIDResponder(resp *http.Response) (result RoleAssignment, 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 role assignment by scope and name. +// Parameters: +// scope - the scope of the operation or resource. Valid scopes are: subscription (format: +// '/subscriptions/{subscriptionId}'), resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// roleAssignmentName - the name of the role assignment. It can be any valid GUID. +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) Delete(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, scope, roleAssignmentName, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoleAssignmentsClient) DeletePreparer(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentName": roleAssignmentName, + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", 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 RoleAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteByID delete a role assignment by ID. +// Parameters: +// roleAssignmentID - the fully qualified ID of the role assignment including scope, resource name, and +// resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. +// Example: +// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) DeleteByID(ctx context.Context, roleAssignmentID string, tenantID string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.DeleteByID") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteByIDPreparer(ctx, roleAssignmentID, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure sending request") + return + } + + result, err = client.DeleteByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "DeleteByID", resp, "Failure responding to request") + return + } + + return +} + +// DeleteByIDPreparer prepares the DeleteByID request. +func (client RoleAssignmentsClient) DeleteByIDPreparer(ctx context.Context, roleAssignmentID string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentId": roleAssignmentID, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteByIDSender sends the DeleteByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteByIDResponder handles the response to the DeleteByID request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteByIDResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get a role assignment by scope and name. +// Parameters: +// scope - the scope of the operation or resource. Valid scopes are: subscription (format: +// '/subscriptions/{subscriptionId}'), resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// roleAssignmentName - the name of the role assignment. It can be any valid GUID. +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) Get(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleAssignmentName, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleAssignmentsClient) GetPreparer(ctx context.Context, scope string, roleAssignmentName string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentName": roleAssignmentName, + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}", 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 RoleAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID get a role assignment by ID. +// Parameters: +// roleAssignmentID - the fully qualified ID of the role assignment including scope, resource name, and +// resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. +// Example: +// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) GetByID(ctx context.Context, roleAssignmentID string, tenantID string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.GetByID") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByIDPreparer(ctx, roleAssignmentID, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client RoleAssignmentsClient) GetByIDPreparer(ctx context.Context, roleAssignmentID string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentId": roleAssignmentID, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleAssignmentId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetByIDResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForResource list all role assignments that apply to a resource. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// resourceProviderNamespace - the namespace of the resource provider. +// resourceType - the resource type name. For example the type name of a web app is 'sites' (from +// Microsoft.Web/sites). +// resourceName - the resource name. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or +// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope +// for the specified principal. +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) ListForResource(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResource") + defer func() { + sc := -1 + if result.ralr.Response.Response != nil { + sc = result.ralr.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("authorization.RoleAssignmentsClient", "ListForResource", err.Error()) + } + + result.fn = client.listForResourceNextResults + req, err := client.ListForResourcePreparer(ctx, resourceGroupName, resourceProviderNamespace, resourceType, resourceName, filter, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceSender(req) + if err != nil { + result.ralr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure sending request") + return + } + + result.ralr, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResource", resp, "Failure responding to request") + return + } + if result.ralr.hasNextLink() && result.ralr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForResourcePreparer prepares the ListForResource request. +func (client RoleAssignmentsClient) ListForResourcePreparer(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, filter string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": resourceName, + "resourceProviderNamespace": resourceProviderNamespace, + "resourceType": resourceType, + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForResourceSender sends the ListForResource request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListForResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForResourceResponder handles the response to the ListForResource request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListForResourceResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForResourceNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) listForResourceNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.roleAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForResourceComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleAssignmentsClient) ListForResourceComplete(ctx context.Context, resourceGroupName string, resourceProviderNamespace string, resourceType string, resourceName string, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResource") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForResource(ctx, resourceGroupName, resourceProviderNamespace, resourceType, resourceName, filter, tenantID) + return +} + +// ListForResourceGroup list all role assignments that apply to a resource group. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or +// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope +// for the specified principal. +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) ListForResourceGroup(ctx context.Context, resourceGroupName string, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResourceGroup") + defer func() { + sc := -1 + if result.ralr.Response.Response != nil { + sc = result.ralr.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("authorization.RoleAssignmentsClient", "ListForResourceGroup", err.Error()) + } + + result.fn = client.listForResourceGroupNextResults + req, err := client.ListForResourceGroupPreparer(ctx, resourceGroupName, filter, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.ralr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure sending request") + return + } + + result.ralr, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForResourceGroup", resp, "Failure responding to request") + return + } + if result.ralr.hasNextLink() && result.ralr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForResourceGroupPreparer prepares the ListForResourceGroup request. +func (client RoleAssignmentsClient) ListForResourceGroupPreparer(ctx context.Context, resourceGroupName string, filter string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForResourceGroupSender sends the ListForResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListForResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForResourceGroupResponder handles the response to the ListForResourceGroup request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListForResourceGroupResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForResourceGroupNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) listForResourceGroupNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.roleAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleAssignmentsClient) ListForResourceGroupComplete(ctx context.Context, resourceGroupName string, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForResourceGroup(ctx, resourceGroupName, filter, tenantID) + return +} + +// ListForScope list all role assignments that apply to a scope. +// Parameters: +// scope - the scope of the operation or resource. Valid scopes are: subscription (format: +// '/subscriptions/{subscriptionId}'), resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or +// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope +// for the specified principal. +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) ListForScope(ctx context.Context, scope string, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForScope") + defer func() { + sc := -1 + if result.ralr.Response.Response != nil { + sc = result.ralr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.ralr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure sending request") + return + } + + result.ralr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.ralr.hasNextLink() && result.ralr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleAssignmentsClient) ListForScopePreparer(ctx context.Context, scope string, filter string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListForScopeResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) listForScopeNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.roleAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleAssignmentsClient) ListForScopeComplete(ctx context.Context, scope string, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter, tenantID) + return +} + +// ListForSubscription list all role assignments that apply to a subscription. +// Parameters: +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignments at or +// above the scope. Use $filter=principalId eq {id} to return all role assignments at, above or below the scope +// for the specified principal. +// tenantID - tenant ID for cross-tenant request +func (client RoleAssignmentsClient) ListForSubscription(ctx context.Context, filter string, tenantID string) (result RoleAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForSubscription") + defer func() { + sc := -1 + if result.ralr.Response.Response != nil { + sc = result.ralr.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("authorization.RoleAssignmentsClient", "ListForSubscription", err.Error()) + } + + result.fn = client.listForSubscriptionNextResults + req, err := client.ListForSubscriptionPreparer(ctx, filter, tenantID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListForSubscriptionSender(req) + if err != nil { + result.ralr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForSubscription", resp, "Failure sending request") + return + } + + result.ralr, err = client.ListForSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ListForSubscription", resp, "Failure responding to request") + return + } + if result.ralr.hasNextLink() && result.ralr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForSubscriptionPreparer prepares the ListForSubscription request. +func (client RoleAssignmentsClient) ListForSubscriptionPreparer(ctx context.Context, filter string, tenantID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = filter + } + if len(tenantID) > 0 { + queryParameters["tenantId"] = autorest.Encode("query", tenantID) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForSubscriptionSender sends the ListForSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListForSubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListForSubscriptionResponder handles the response to the ListForSubscription request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListForSubscriptionResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForSubscriptionNextResults retrieves the next set of results, if any. +func (client RoleAssignmentsClient) listForSubscriptionNextResults(ctx context.Context, lastResults RoleAssignmentListResult) (result RoleAssignmentListResult, err error) { + req, err := lastResults.roleAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForSubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForSubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "listForSubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleAssignmentsClient) ListForSubscriptionComplete(ctx context.Context, filter string, tenantID string) (result RoleAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListForSubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForSubscription(ctx, filter, tenantID) + return +} + +// Validate validate a role assignment create or update operation by scope and name. +// Parameters: +// scope - the scope of the operation or resource. Valid scopes are: subscription (format: +// '/subscriptions/{subscriptionId}'), resource group (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', or resource (format: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' +// roleAssignmentName - the name of the role assignment. It can be any valid GUID. +// parameters - parameters for the role assignment. +func (client RoleAssignmentsClient) Validate(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (result ValidationResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.Validate") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RoleAssignmentProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentsClient", "Validate", err.Error()) + } + + req, err := client.ValidatePreparer(ctx, scope, roleAssignmentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Validate", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Validate", resp, "Failure sending request") + return + } + + result, err = client.ValidateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "Validate", resp, "Failure responding to request") + return + } + + return +} + +// ValidatePreparer prepares the Validate request. +func (client RoleAssignmentsClient) ValidatePreparer(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentName": roleAssignmentName, + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateSender sends the Validate request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ValidateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ValidateResponder handles the response to the Validate request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ValidateResponder(resp *http.Response) (result ValidationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ValidateByID validate a role assignment create or update operation by ID. +// Parameters: +// roleAssignmentID - the fully qualified ID of the role assignment including scope, resource name, and +// resource type. Format: /{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}. +// Example: +// /subscriptions//resourcegroups//providers/Microsoft.Authorization/roleAssignments/ +// parameters - parameters for the role assignment. +func (client RoleAssignmentsClient) ValidateByID(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters) (result ValidationResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ValidateByID") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.RoleAssignmentProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RoleAssignmentProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentsClient", "ValidateByID", err.Error()) + } + + req, err := client.ValidateByIDPreparer(ctx, roleAssignmentID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ValidateByID", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ValidateByID", resp, "Failure sending request") + return + } + + result, err = client.ValidateByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentsClient", "ValidateByID", resp, "Failure responding to request") + return + } + + return +} + +// ValidateByIDPreparer prepares the ValidateByID request. +func (client RoleAssignmentsClient) ValidateByIDPreparer(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentId": roleAssignmentID, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleAssignmentId}/validate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateByIDSender sends the ValidateByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ValidateByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ValidateByIDResponder handles the response to the ValidateByID request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ValidateByIDResponder(resp *http.Response) (result ValidationResponse, 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/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentscheduleinstances.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentscheduleinstances.go new file mode 100644 index 000000000000..2622b835caaf --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentscheduleinstances.go @@ -0,0 +1,232 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// RoleAssignmentScheduleInstancesClient is the client for the RoleAssignmentScheduleInstances methods of the +// Authorization service. +type RoleAssignmentScheduleInstancesClient struct { + BaseClient +} + +// NewRoleAssignmentScheduleInstancesClient creates an instance of the RoleAssignmentScheduleInstancesClient client. +func NewRoleAssignmentScheduleInstancesClient(subscriptionID string) RoleAssignmentScheduleInstancesClient { + return NewRoleAssignmentScheduleInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentScheduleInstancesClientWithBaseURI creates an instance of the RoleAssignmentScheduleInstancesClient +// 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 NewRoleAssignmentScheduleInstancesClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentScheduleInstancesClient { + return RoleAssignmentScheduleInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified role assignment schedule instance. +// Parameters: +// scope - the scope of the role assignments schedules. +// roleAssignmentScheduleInstanceName - the name (hash of schedule name + time) of the role assignment schedule +// to get. +func (client RoleAssignmentScheduleInstancesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string) (result RoleAssignmentScheduleInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleInstancesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleAssignmentScheduleInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleAssignmentScheduleInstancesClient) GetPreparer(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentScheduleInstanceName": autorest.Encode("path", roleAssignmentScheduleInstanceName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}", 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 RoleAssignmentScheduleInstancesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleAssignmentScheduleInstancesClient) GetResponder(resp *http.Response) (result RoleAssignmentScheduleInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role assignment schedule instances of a role assignment schedule. +// Parameters: +// scope - the scope of the role assignment schedule. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules +// at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedules at, above or +// below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role +// assignment schedule instances for the user. Use $filter=asTarget() to return all role assignment schedule +// instances created for the current user. +func (client RoleAssignmentScheduleInstancesClient) ListForScope(ctx context.Context, scope string, filter string) (result RoleAssignmentScheduleInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleInstancesClient.ListForScope") + defer func() { + sc := -1 + if result.rasilr.Response.Response != nil { + sc = result.rasilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.rasilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "ListForScope", resp, "Failure sending request") + return + } + + result.rasilr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.rasilr.hasNextLink() && result.rasilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleAssignmentScheduleInstancesClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentScheduleInstancesClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleAssignmentScheduleInstancesClient) ListForScopeResponder(resp *http.Response) (result RoleAssignmentScheduleInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleAssignmentScheduleInstancesClient) listForScopeNextResults(ctx context.Context, lastResults RoleAssignmentScheduleInstanceListResult) (result RoleAssignmentScheduleInstanceListResult, err error) { + req, err := lastResults.roleAssignmentScheduleInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleInstancesClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleAssignmentScheduleInstancesClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result RoleAssignmentScheduleInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleInstancesClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentschedulerequests.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentschedulerequests.go new file mode 100644 index 000000000000..cc0a4d943eb1 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentschedulerequests.go @@ -0,0 +1,404 @@ +package authorization + +// 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" +) + +// RoleAssignmentScheduleRequestsClient is the client for the RoleAssignmentScheduleRequests methods of the +// Authorization service. +type RoleAssignmentScheduleRequestsClient struct { + BaseClient +} + +// NewRoleAssignmentScheduleRequestsClient creates an instance of the RoleAssignmentScheduleRequestsClient client. +func NewRoleAssignmentScheduleRequestsClient(subscriptionID string) RoleAssignmentScheduleRequestsClient { + return NewRoleAssignmentScheduleRequestsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentScheduleRequestsClientWithBaseURI creates an instance of the RoleAssignmentScheduleRequestsClient +// 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 NewRoleAssignmentScheduleRequestsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentScheduleRequestsClient { + return RoleAssignmentScheduleRequestsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancels a pending role assignment schedule request. +// Parameters: +// scope - the scope of the role assignment request to cancel. +// roleAssignmentScheduleRequestName - the name of the role assignment request to cancel. +func (client RoleAssignmentScheduleRequestsClient) Cancel(ctx context.Context, scope string, roleAssignmentScheduleRequestName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleRequestsClient.Cancel") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CancelPreparer(ctx, scope, roleAssignmentScheduleRequestName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Cancel", resp, "Failure responding to request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client RoleAssignmentScheduleRequestsClient) CancelPreparer(ctx context.Context, scope string, roleAssignmentScheduleRequestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentScheduleRequestName": autorest.Encode("path", roleAssignmentScheduleRequestName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentScheduleRequestsClient) CancelSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client RoleAssignmentScheduleRequestsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create creates a role assignment schedule request. +// Parameters: +// scope - the scope of the role assignment schedule request to create. The scope can be any REST resource +// instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a +// subscription, +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for +// a resource group, and +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// roleAssignmentScheduleRequestName - a GUID for the role assignment to create. The name must be unique and +// different for each role assignment. +// parameters - parameters for the role assignment schedule request. +func (client RoleAssignmentScheduleRequestsClient) Create(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest) (result RoleAssignmentScheduleRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleRequestsClient.Create") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RoleAssignmentScheduleRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RoleAssignmentScheduleRequestProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RoleAssignmentScheduleRequestProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authorization.RoleAssignmentScheduleRequestsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, scope, roleAssignmentScheduleRequestName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RoleAssignmentScheduleRequestsClient) CreatePreparer(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentScheduleRequestName": autorest.Encode("path", roleAssignmentScheduleRequestName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentScheduleRequestsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RoleAssignmentScheduleRequestsClient) CreateResponder(resp *http.Response) (result RoleAssignmentScheduleRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the specified role assignment schedule request. +// Parameters: +// scope - the scope of the role assignment schedule request. +// roleAssignmentScheduleRequestName - the name (guid) of the role assignment schedule request to get. +func (client RoleAssignmentScheduleRequestsClient) Get(ctx context.Context, scope string, roleAssignmentScheduleRequestName string) (result RoleAssignmentScheduleRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleRequestsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleAssignmentScheduleRequestName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleAssignmentScheduleRequestsClient) GetPreparer(ctx context.Context, scope string, roleAssignmentScheduleRequestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentScheduleRequestName": autorest.Encode("path", roleAssignmentScheduleRequestName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}", 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 RoleAssignmentScheduleRequestsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleAssignmentScheduleRequestsClient) GetResponder(resp *http.Response) (result RoleAssignmentScheduleRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role assignment schedule requests for a scope. +// Parameters: +// scope - the scope of the role assignments schedule requests. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignment schedule +// requests at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedule +// requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all +// role assignment schedule requests requested by the current user. Use $filter=asTarget() to return all role +// assignment schedule requests created for the current user. Use $filter=asApprover() to return all role +// assignment schedule requests where the current user is an approver. +func (client RoleAssignmentScheduleRequestsClient) ListForScope(ctx context.Context, scope string, filter string) (result RoleAssignmentScheduleRequestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleRequestsClient.ListForScope") + defer func() { + sc := -1 + if result.rasrlr.Response.Response != nil { + sc = result.rasrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.rasrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "ListForScope", resp, "Failure sending request") + return + } + + result.rasrlr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.rasrlr.hasNextLink() && result.rasrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleAssignmentScheduleRequestsClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentScheduleRequestsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleAssignmentScheduleRequestsClient) ListForScopeResponder(resp *http.Response) (result RoleAssignmentScheduleRequestListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleAssignmentScheduleRequestsClient) listForScopeNextResults(ctx context.Context, lastResults RoleAssignmentScheduleRequestListResult) (result RoleAssignmentScheduleRequestListResult, err error) { + req, err := lastResults.roleAssignmentScheduleRequestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentScheduleRequestsClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleAssignmentScheduleRequestsClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result RoleAssignmentScheduleRequestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentScheduleRequestsClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentschedules.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentschedules.go new file mode 100644 index 000000000000..7e46ba24f7a9 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleassignmentschedules.go @@ -0,0 +1,230 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// RoleAssignmentSchedulesClient is the client for the RoleAssignmentSchedules methods of the Authorization service. +type RoleAssignmentSchedulesClient struct { + BaseClient +} + +// NewRoleAssignmentSchedulesClient creates an instance of the RoleAssignmentSchedulesClient client. +func NewRoleAssignmentSchedulesClient(subscriptionID string) RoleAssignmentSchedulesClient { + return NewRoleAssignmentSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentSchedulesClientWithBaseURI creates an instance of the RoleAssignmentSchedulesClient 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 NewRoleAssignmentSchedulesClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentSchedulesClient { + return RoleAssignmentSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the specified role assignment schedule for a resource scope +// Parameters: +// scope - the scope of the role assignment schedule. +// roleAssignmentScheduleName - the name (guid) of the role assignment schedule to get. +func (client RoleAssignmentSchedulesClient) Get(ctx context.Context, scope string, roleAssignmentScheduleName string) (result RoleAssignmentSchedule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentSchedulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleAssignmentScheduleName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleAssignmentSchedulesClient) GetPreparer(ctx context.Context, scope string, roleAssignmentScheduleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleAssignmentScheduleName": autorest.Encode("path", roleAssignmentScheduleName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}", 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 RoleAssignmentSchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleAssignmentSchedulesClient) GetResponder(resp *http.Response) (result RoleAssignmentSchedule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role assignment schedules for a resource scope. +// Parameters: +// scope - the scope of the role assignments schedules. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules +// at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedules at, above or +// below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role +// assignment schedules for the current user. Use $filter=asTarget() to return all role assignment schedules +// created for the current user. +func (client RoleAssignmentSchedulesClient) ListForScope(ctx context.Context, scope string, filter string) (result RoleAssignmentScheduleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentSchedulesClient.ListForScope") + defer func() { + sc := -1 + if result.raslr.Response.Response != nil { + sc = result.raslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.raslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "ListForScope", resp, "Failure sending request") + return + } + + result.raslr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.raslr.hasNextLink() && result.raslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleAssignmentSchedulesClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentSchedulesClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleAssignmentSchedulesClient) ListForScopeResponder(resp *http.Response) (result RoleAssignmentScheduleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleAssignmentSchedulesClient) listForScopeNextResults(ctx context.Context, lastResults RoleAssignmentScheduleListResult) (result RoleAssignmentScheduleListResult, err error) { + req, err := lastResults.roleAssignmentScheduleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleAssignmentSchedulesClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleAssignmentSchedulesClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result RoleAssignmentScheduleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentSchedulesClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roledefinitions.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roledefinitions.go new file mode 100644 index 000000000000..445a59445e3d --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roledefinitions.go @@ -0,0 +1,458 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// RoleDefinitionsClient is the client for the RoleDefinitions methods of the Authorization service. +type RoleDefinitionsClient struct { + BaseClient +} + +// NewRoleDefinitionsClient creates an instance of the RoleDefinitionsClient client. +func NewRoleDefinitionsClient(subscriptionID string) RoleDefinitionsClient { + return NewRoleDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleDefinitionsClientWithBaseURI creates an instance of the RoleDefinitionsClient 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 NewRoleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) RoleDefinitionsClient { + return RoleDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a role definition. +// Parameters: +// scope - the scope of the role definition. +// roleDefinitionID - the ID of the role definition. +// roleDefinition - the values for the role definition. +func (client RoleDefinitionsClient) CreateOrUpdate(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition) (result RoleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, scope, roleDefinitionID, roleDefinition) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RoleDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "scope": scope, + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + roleDefinition.ID = nil + roleDefinition.Name = nil + roleDefinition.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", pathParameters), + autorest.WithJSON(roleDefinition), + 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 RoleDefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result RoleDefinition, 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 deletes a role definition. +// Parameters: +// scope - the scope of the role definition. +// roleDefinitionID - the ID of the role definition to delete. +func (client RoleDefinitionsClient) Delete(ctx context.Context, scope string, roleDefinitionID string) (result RoleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.Delete") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, scope, roleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoleDefinitionsClient) DeletePreparer(ctx context.Context, scope string, roleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "scope": scope, + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", 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 RoleDefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) DeleteResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get role definition by name (GUID). +// Parameters: +// scope - the scope of the role definition. +// roleDefinitionID - the ID of the role definition. +func (client RoleDefinitionsClient) Get(ctx context.Context, scope string, roleDefinitionID string) (result RoleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleDefinitionID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleDefinitionsClient) GetPreparer(ctx context.Context, scope string, roleDefinitionID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleDefinitionId": autorest.Encode("path", roleDefinitionID), + "scope": scope, + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}", 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 RoleDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) GetResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByID gets a role definition by ID. +// Parameters: +// roleID - the fully qualified role definition ID. Use the format, +// /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription +// level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant +// level role definitions. +func (client RoleDefinitionsClient) GetByID(ctx context.Context, roleID string) (result RoleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.GetByID") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByIDPreparer(ctx, roleID) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", nil, "Failure preparing request") + return + } + + resp, err := client.GetByIDSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure sending request") + return + } + + result, err = client.GetByIDResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "GetByID", resp, "Failure responding to request") + return + } + + return +} + +// GetByIDPreparer prepares the GetByID request. +func (client RoleDefinitionsClient) GetByIDPreparer(ctx context.Context, roleID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleId": roleID, + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{roleId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByIDSender sends the GetByID request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByIDResponder handles the response to the GetByID request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) GetByIDResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all role definitions that are applicable at scope and above. +// Parameters: +// scope - the scope of the role definition. +// filter - the filter to apply on the operation. Use atScopeAndBelow filter to search below the given scope as +// well. +func (client RoleDefinitionsClient) List(ctx context.Context, scope string, filter string) (result RoleDefinitionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.List") + defer func() { + sc := -1 + if result.rdlr.Response.Response != nil { + sc = result.rdlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rdlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure sending request") + return + } + + result.rdlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "List", resp, "Failure responding to request") + return + } + if result.rdlr.hasNextLink() && result.rdlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client RoleDefinitionsClient) ListPreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2018-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) ListResponder(resp *http.Response) (result RoleDefinitionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client RoleDefinitionsClient) listNextResults(ctx context.Context, lastResults RoleDefinitionListResult) (result RoleDefinitionListResult, err error) { + req, err := lastResults.roleDefinitionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleDefinitionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleDefinitionsClient) ListComplete(ctx context.Context, scope string, filter string) (result RoleDefinitionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityscheduleinstances.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityscheduleinstances.go new file mode 100644 index 000000000000..e9bf11d29748 --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityscheduleinstances.go @@ -0,0 +1,232 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// RoleEligibilityScheduleInstancesClient is the client for the RoleEligibilityScheduleInstances methods of the +// Authorization service. +type RoleEligibilityScheduleInstancesClient struct { + BaseClient +} + +// NewRoleEligibilityScheduleInstancesClient creates an instance of the RoleEligibilityScheduleInstancesClient client. +func NewRoleEligibilityScheduleInstancesClient(subscriptionID string) RoleEligibilityScheduleInstancesClient { + return NewRoleEligibilityScheduleInstancesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleEligibilityScheduleInstancesClientWithBaseURI creates an instance of the +// RoleEligibilityScheduleInstancesClient 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 NewRoleEligibilityScheduleInstancesClientWithBaseURI(baseURI string, subscriptionID string) RoleEligibilityScheduleInstancesClient { + return RoleEligibilityScheduleInstancesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets the specified role eligibility schedule instance. +// Parameters: +// scope - the scope of the role eligibility schedules. +// roleEligibilityScheduleInstanceName - the name (hash of schedule name + time) of the role eligibility +// schedule to get. +func (client RoleEligibilityScheduleInstancesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string) (result RoleEligibilityScheduleInstance, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleInstancesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleEligibilityScheduleInstanceName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleEligibilityScheduleInstancesClient) GetPreparer(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleEligibilityScheduleInstanceName": autorest.Encode("path", roleEligibilityScheduleInstanceName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}", 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 RoleEligibilityScheduleInstancesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleEligibilityScheduleInstancesClient) GetResponder(resp *http.Response) (result RoleEligibilityScheduleInstance, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role eligibility schedule instances of a role eligibility schedule. +// Parameters: +// scope - the scope of the role eligibility schedule. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role assignment schedules +// at or above the scope. Use $filter=principalId eq {id} to return all role assignment schedules at, above or +// below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all role +// eligibility schedules for the user. Use $filter=asTarget() to return all role eligibility schedules created +// for the current user. +func (client RoleEligibilityScheduleInstancesClient) ListForScope(ctx context.Context, scope string, filter string) (result RoleEligibilityScheduleInstanceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleInstancesClient.ListForScope") + defer func() { + sc := -1 + if result.resilr.Response.Response != nil { + sc = result.resilr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.resilr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "ListForScope", resp, "Failure sending request") + return + } + + result.resilr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.resilr.hasNextLink() && result.resilr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleEligibilityScheduleInstancesClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleEligibilityScheduleInstancesClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleEligibilityScheduleInstancesClient) ListForScopeResponder(resp *http.Response) (result RoleEligibilityScheduleInstanceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleEligibilityScheduleInstancesClient) listForScopeNextResults(ctx context.Context, lastResults RoleEligibilityScheduleInstanceListResult) (result RoleEligibilityScheduleInstanceListResult, err error) { + req, err := lastResults.roleEligibilityScheduleInstanceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleInstancesClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleEligibilityScheduleInstancesClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result RoleEligibilityScheduleInstanceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleInstancesClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityschedulerequests.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityschedulerequests.go new file mode 100644 index 000000000000..9a2ab95ffb5b --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityschedulerequests.go @@ -0,0 +1,403 @@ +package authorization + +// 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" +) + +// RoleEligibilityScheduleRequestsClient is the client for the RoleEligibilityScheduleRequests methods of the +// Authorization service. +type RoleEligibilityScheduleRequestsClient struct { + BaseClient +} + +// NewRoleEligibilityScheduleRequestsClient creates an instance of the RoleEligibilityScheduleRequestsClient client. +func NewRoleEligibilityScheduleRequestsClient(subscriptionID string) RoleEligibilityScheduleRequestsClient { + return NewRoleEligibilityScheduleRequestsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleEligibilityScheduleRequestsClientWithBaseURI creates an instance of the RoleEligibilityScheduleRequestsClient +// 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 NewRoleEligibilityScheduleRequestsClientWithBaseURI(baseURI string, subscriptionID string) RoleEligibilityScheduleRequestsClient { + return RoleEligibilityScheduleRequestsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Cancel cancels a pending role eligibility schedule request. +// Parameters: +// scope - the scope of the role eligibility request to cancel. +// roleEligibilityScheduleRequestName - the name of the role eligibility request to cancel. +func (client RoleEligibilityScheduleRequestsClient) Cancel(ctx context.Context, scope string, roleEligibilityScheduleRequestName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleRequestsClient.Cancel") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CancelPreparer(ctx, scope, roleEligibilityScheduleRequestName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Cancel", nil, "Failure preparing request") + return + } + + resp, err := client.CancelSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Cancel", resp, "Failure sending request") + return + } + + result, err = client.CancelResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Cancel", resp, "Failure responding to request") + return + } + + return +} + +// CancelPreparer prepares the Cancel request. +func (client RoleEligibilityScheduleRequestsClient) CancelPreparer(ctx context.Context, scope string, roleEligibilityScheduleRequestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleEligibilityScheduleRequestName": autorest.Encode("path", roleEligibilityScheduleRequestName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CancelSender sends the Cancel request. The method will close the +// http.Response Body if it receives an error. +func (client RoleEligibilityScheduleRequestsClient) CancelSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CancelResponder handles the response to the Cancel request. The method always +// closes the http.Response Body. +func (client RoleEligibilityScheduleRequestsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Create creates a role eligibility schedule request. +// Parameters: +// scope - the scope of the role eligibility schedule request to create. The scope can be any REST resource +// instance. For example, use '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/' for a +// subscription, +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for +// a resource group, and +// '/providers/Microsoft.Subscription/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' +// for a resource. +// roleEligibilityScheduleRequestName - the name of the role eligibility to create. It can be any valid GUID. +// parameters - parameters for the role eligibility schedule request. +func (client RoleEligibilityScheduleRequestsClient) Create(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest) (result RoleEligibilityScheduleRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleRequestsClient.Create") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RoleEligibilityScheduleRequestProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "parameters.RoleEligibilityScheduleRequestProperties.RoleDefinitionID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.RoleEligibilityScheduleRequestProperties.PrincipalID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("authorization.RoleEligibilityScheduleRequestsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, scope, roleEligibilityScheduleRequestName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RoleEligibilityScheduleRequestsClient) CreatePreparer(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleEligibilityScheduleRequestName": autorest.Encode("path", roleEligibilityScheduleRequestName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RoleEligibilityScheduleRequestsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RoleEligibilityScheduleRequestsClient) CreateResponder(resp *http.Response) (result RoleEligibilityScheduleRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the specified role eligibility schedule request. +// Parameters: +// scope - the scope of the role eligibility schedule request. +// roleEligibilityScheduleRequestName - the name (guid) of the role eligibility schedule request to get. +func (client RoleEligibilityScheduleRequestsClient) Get(ctx context.Context, scope string, roleEligibilityScheduleRequestName string) (result RoleEligibilityScheduleRequest, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleRequestsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleEligibilityScheduleRequestName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleEligibilityScheduleRequestsClient) GetPreparer(ctx context.Context, scope string, roleEligibilityScheduleRequestName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleEligibilityScheduleRequestName": autorest.Encode("path", roleEligibilityScheduleRequestName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}", 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 RoleEligibilityScheduleRequestsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleEligibilityScheduleRequestsClient) GetResponder(resp *http.Response) (result RoleEligibilityScheduleRequest, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role eligibility schedule requests for a scope. +// Parameters: +// scope - the scope of the role eligibility schedule requests. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role eligibility schedule +// requests at or above the scope. Use $filter=principalId eq {id} to return all role eligibility schedule +// requests at, above or below the scope for the specified principal. Use $filter=asRequestor() to return all +// role eligibility schedule requests requested by the current user. Use $filter=asTarget() to return all role +// eligibility schedule requests created for the current user. Use $filter=asApprover() to return all role +// eligibility schedule requests where the current user is an approver. +func (client RoleEligibilityScheduleRequestsClient) ListForScope(ctx context.Context, scope string, filter string) (result RoleEligibilityScheduleRequestListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleRequestsClient.ListForScope") + defer func() { + sc := -1 + if result.resrlr.Response.Response != nil { + sc = result.resrlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.resrlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "ListForScope", resp, "Failure sending request") + return + } + + result.resrlr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.resrlr.hasNextLink() && result.resrlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleEligibilityScheduleRequestsClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleEligibilityScheduleRequestsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleEligibilityScheduleRequestsClient) ListForScopeResponder(resp *http.Response) (result RoleEligibilityScheduleRequestListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleEligibilityScheduleRequestsClient) listForScopeNextResults(ctx context.Context, lastResults RoleEligibilityScheduleRequestListResult) (result RoleEligibilityScheduleRequestListResult, err error) { + req, err := lastResults.roleEligibilityScheduleRequestListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilityScheduleRequestsClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleEligibilityScheduleRequestsClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result RoleEligibilityScheduleRequestListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilityScheduleRequestsClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityschedules.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityschedules.go new file mode 100644 index 000000000000..704d5d6f406c --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/roleeligibilityschedules.go @@ -0,0 +1,230 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// RoleEligibilitySchedulesClient is the client for the RoleEligibilitySchedules methods of the Authorization service. +type RoleEligibilitySchedulesClient struct { + BaseClient +} + +// NewRoleEligibilitySchedulesClient creates an instance of the RoleEligibilitySchedulesClient client. +func NewRoleEligibilitySchedulesClient(subscriptionID string) RoleEligibilitySchedulesClient { + return NewRoleEligibilitySchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleEligibilitySchedulesClientWithBaseURI creates an instance of the RoleEligibilitySchedulesClient 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 NewRoleEligibilitySchedulesClientWithBaseURI(baseURI string, subscriptionID string) RoleEligibilitySchedulesClient { + return RoleEligibilitySchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the specified role eligibility schedule for a resource scope +// Parameters: +// scope - the scope of the role eligibility schedule. +// roleEligibilityScheduleName - the name (guid) of the role eligibility schedule to get. +func (client RoleEligibilitySchedulesClient) Get(ctx context.Context, scope string, roleEligibilityScheduleName string) (result RoleEligibilitySchedule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilitySchedulesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleEligibilityScheduleName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleEligibilitySchedulesClient) GetPreparer(ctx context.Context, scope string, roleEligibilityScheduleName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleEligibilityScheduleName": autorest.Encode("path", roleEligibilityScheduleName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}", 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 RoleEligibilitySchedulesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleEligibilitySchedulesClient) GetResponder(resp *http.Response) (result RoleEligibilitySchedule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role eligibility schedules for a resource scope. +// Parameters: +// scope - the scope of the role eligibility schedules. +// filter - the filter to apply on the operation. Use $filter=atScope() to return all role eligibility +// schedules at or above the scope. Use $filter=principalId eq {id} to return all role eligibility schedules +// at, above or below the scope for the specified principal. Use $filter=assignedTo('{userId}') to return all +// role eligibility schedules for the user. Use $filter=asTarget() to return all role eligibility schedules +// created for the current user. +func (client RoleEligibilitySchedulesClient) ListForScope(ctx context.Context, scope string, filter string) (result RoleEligibilityScheduleListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilitySchedulesClient.ListForScope") + defer func() { + sc := -1 + if result.reslr.Response.Response != nil { + sc = result.reslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.reslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "ListForScope", resp, "Failure sending request") + return + } + + result.reslr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.reslr.hasNextLink() && result.reslr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleEligibilitySchedulesClient) ListForScopePreparer(ctx context.Context, scope string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleEligibilitySchedulesClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleEligibilitySchedulesClient) ListForScopeResponder(resp *http.Response) (result RoleEligibilityScheduleListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleEligibilitySchedulesClient) listForScopeNextResults(ctx context.Context, lastResults RoleEligibilityScheduleListResult) (result RoleEligibilityScheduleListResult, err error) { + req, err := lastResults.roleEligibilityScheduleListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleEligibilitySchedulesClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleEligibilitySchedulesClient) ListForScopeComplete(ctx context.Context, scope string, filter string) (result RoleEligibilityScheduleListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleEligibilitySchedulesClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope, filter) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/rolemanagementpolicies.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/rolemanagementpolicies.go new file mode 100644 index 000000000000..a30fc19f122b --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/rolemanagementpolicies.go @@ -0,0 +1,377 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// RoleManagementPoliciesClient is the client for the RoleManagementPolicies methods of the Authorization service. +type RoleManagementPoliciesClient struct { + BaseClient +} + +// NewRoleManagementPoliciesClient creates an instance of the RoleManagementPoliciesClient client. +func NewRoleManagementPoliciesClient(subscriptionID string) RoleManagementPoliciesClient { + return NewRoleManagementPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleManagementPoliciesClientWithBaseURI creates an instance of the RoleManagementPoliciesClient 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 NewRoleManagementPoliciesClientWithBaseURI(baseURI string, subscriptionID string) RoleManagementPoliciesClient { + return RoleManagementPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete a role management policy +// Parameters: +// scope - the scope of the role management policy to upsert. +// roleManagementPolicyName - the name (guid) of the role management policy to upsert. +func (client RoleManagementPoliciesClient) Delete(ctx context.Context, scope string, roleManagementPolicyName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPoliciesClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, scope, roleManagementPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoleManagementPoliciesClient) DeletePreparer(ctx context.Context, scope string, roleManagementPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleManagementPolicyName": autorest.Encode("path", roleManagementPolicyName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}", 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 RoleManagementPoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoleManagementPoliciesClient) 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 the specified role management policy for a resource scope +// Parameters: +// scope - the scope of the role management policy. +// roleManagementPolicyName - the name (guid) of the role management policy to get. +func (client RoleManagementPoliciesClient) Get(ctx context.Context, scope string, roleManagementPolicyName string) (result RoleManagementPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPoliciesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleManagementPolicyName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleManagementPoliciesClient) GetPreparer(ctx context.Context, scope string, roleManagementPolicyName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleManagementPolicyName": autorest.Encode("path", roleManagementPolicyName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}", 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 RoleManagementPoliciesClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleManagementPoliciesClient) GetResponder(resp *http.Response) (result RoleManagementPolicy, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role management policies for a resource scope. +// Parameters: +// scope - the scope of the role management policy. +func (client RoleManagementPoliciesClient) ListForScope(ctx context.Context, scope string) (result RoleManagementPolicyListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPoliciesClient.ListForScope") + defer func() { + sc := -1 + if result.rmplr.Response.Response != nil { + sc = result.rmplr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.rmplr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "ListForScope", resp, "Failure sending request") + return + } + + result.rmplr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.rmplr.hasNextLink() && result.rmplr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleManagementPoliciesClient) ListForScopePreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicies", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleManagementPoliciesClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleManagementPoliciesClient) ListForScopeResponder(resp *http.Response) (result RoleManagementPolicyListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleManagementPoliciesClient) listForScopeNextResults(ctx context.Context, lastResults RoleManagementPolicyListResult) (result RoleManagementPolicyListResult, err error) { + req, err := lastResults.roleManagementPolicyListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleManagementPoliciesClient) ListForScopeComplete(ctx context.Context, scope string) (result RoleManagementPolicyListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPoliciesClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope) + return +} + +// Update update a role management policy +// Parameters: +// scope - the scope of the role management policy to upsert. +// roleManagementPolicyName - the name (guid) of the role management policy to upsert. +// parameters - parameters for the role management policy. +func (client RoleManagementPoliciesClient) Update(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy) (result RoleManagementPolicy, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPoliciesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, scope, roleManagementPolicyName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPoliciesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client RoleManagementPoliciesClient) UpdatePreparer(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleManagementPolicyName": autorest.Encode("path", roleManagementPolicyName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client RoleManagementPoliciesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client RoleManagementPoliciesClient) UpdateResponder(resp *http.Response) (result RoleManagementPolicy, 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/authorization/mgmt/2020-10-01-preview/authorization/rolemanagementpolicyassignments.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/rolemanagementpolicyassignments.go new file mode 100644 index 000000000000..29e30c8d004b --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/rolemanagementpolicyassignments.go @@ -0,0 +1,381 @@ +package authorization + +// 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/tracing" + "net/http" +) + +// RoleManagementPolicyAssignmentsClient is the client for the RoleManagementPolicyAssignments methods of the +// Authorization service. +type RoleManagementPolicyAssignmentsClient struct { + BaseClient +} + +// NewRoleManagementPolicyAssignmentsClient creates an instance of the RoleManagementPolicyAssignmentsClient client. +func NewRoleManagementPolicyAssignmentsClient(subscriptionID string) RoleManagementPolicyAssignmentsClient { + return NewRoleManagementPolicyAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleManagementPolicyAssignmentsClientWithBaseURI creates an instance of the RoleManagementPolicyAssignmentsClient +// 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 NewRoleManagementPolicyAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleManagementPolicyAssignmentsClient { + return RoleManagementPolicyAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a role management policy assignment +// Parameters: +// scope - the scope of the role management policy assignment to upsert. +// roleManagementPolicyAssignmentName - the name of format {guid_guid} the role management policy assignment to +// upsert. +// parameters - parameters for the role management policy assignment. +func (client RoleManagementPolicyAssignmentsClient) Create(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment) (result RoleManagementPolicyAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyAssignmentsClient.Create") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreatePreparer(ctx, scope, roleManagementPolicyAssignmentName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Create", nil, "Failure preparing request") + return + } + + resp, err := client.CreateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Create", resp, "Failure sending request") + return + } + + result, err = client.CreateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Create", resp, "Failure responding to request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client RoleManagementPolicyAssignmentsClient) CreatePreparer(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleManagementPolicyAssignmentName": autorest.Encode("path", roleManagementPolicyAssignmentName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client RoleManagementPolicyAssignmentsClient) CreateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client RoleManagementPolicyAssignmentsClient) CreateResponder(resp *http.Response) (result RoleManagementPolicyAssignment, 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 role management policy assignment +// Parameters: +// scope - the scope of the role management policy assignment to delete. +// roleManagementPolicyAssignmentName - the name of format {guid_guid} the role management policy assignment to +// delete. +func (client RoleManagementPolicyAssignmentsClient) Delete(ctx context.Context, scope string, roleManagementPolicyAssignmentName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyAssignmentsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, scope, roleManagementPolicyAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RoleManagementPolicyAssignmentsClient) DeletePreparer(ctx context.Context, scope string, roleManagementPolicyAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleManagementPolicyAssignmentName": autorest.Encode("path", roleManagementPolicyAssignmentName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}", 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 RoleManagementPolicyAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RoleManagementPolicyAssignmentsClient) 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 the specified role management policy assignment for a resource scope +// Parameters: +// scope - the scope of the role management policy. +// roleManagementPolicyAssignmentName - the name of format {guid_guid} the role management policy assignment to +// get. +func (client RoleManagementPolicyAssignmentsClient) Get(ctx context.Context, scope string, roleManagementPolicyAssignmentName string) (result RoleManagementPolicyAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyAssignmentsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, roleManagementPolicyAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RoleManagementPolicyAssignmentsClient) GetPreparer(ctx context.Context, scope string, roleManagementPolicyAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "roleManagementPolicyAssignmentName": autorest.Encode("path", roleManagementPolicyAssignmentName), + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}", 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 RoleManagementPolicyAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client RoleManagementPolicyAssignmentsClient) GetResponder(resp *http.Response) (result RoleManagementPolicyAssignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListForScope gets role management assignment policies for a resource scope. +// Parameters: +// scope - the scope of the role management policy. +func (client RoleManagementPolicyAssignmentsClient) ListForScope(ctx context.Context, scope string) (result RoleManagementPolicyAssignmentListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyAssignmentsClient.ListForScope") + defer func() { + sc := -1 + if result.rmpalr.Response.Response != nil { + sc = result.rmpalr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listForScopeNextResults + req, err := client.ListForScopePreparer(ctx, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "ListForScope", nil, "Failure preparing request") + return + } + + resp, err := client.ListForScopeSender(req) + if err != nil { + result.rmpalr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "ListForScope", resp, "Failure sending request") + return + } + + result.rmpalr, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "ListForScope", resp, "Failure responding to request") + return + } + if result.rmpalr.hasNextLink() && result.rmpalr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListForScopePreparer prepares the ListForScope request. +func (client RoleManagementPolicyAssignmentsClient) ListForScopePreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListForScopeSender sends the ListForScope request. The method will close the +// http.Response Body if it receives an error. +func (client RoleManagementPolicyAssignmentsClient) ListForScopeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListForScopeResponder handles the response to the ListForScope request. The method always +// closes the http.Response Body. +func (client RoleManagementPolicyAssignmentsClient) ListForScopeResponder(resp *http.Response) (result RoleManagementPolicyAssignmentListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listForScopeNextResults retrieves the next set of results, if any. +func (client RoleManagementPolicyAssignmentsClient) listForScopeNextResults(ctx context.Context, lastResults RoleManagementPolicyAssignmentListResult) (result RoleManagementPolicyAssignmentListResult, err error) { + req, err := lastResults.roleManagementPolicyAssignmentListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "listForScopeNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListForScopeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "listForScopeNextResults", resp, "Failure sending next results request") + } + result, err = client.ListForScopeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "authorization.RoleManagementPolicyAssignmentsClient", "listForScopeNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListForScopeComplete enumerates all values, automatically crossing page boundaries as required. +func (client RoleManagementPolicyAssignmentsClient) ListForScopeComplete(ctx context.Context, scope string) (result RoleManagementPolicyAssignmentListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleManagementPolicyAssignmentsClient.ListForScope") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListForScope(ctx, scope) + return +} diff --git a/services/preview/authorization/mgmt/2020-10-01-preview/authorization/version.go b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/version.go new file mode 100644 index 000000000000..c73a55c84a3c --- /dev/null +++ b/services/preview/authorization/mgmt/2020-10-01-preview/authorization/version.go @@ -0,0 +1,19 @@ +package authorization + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " authorization/2020-10-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/CHANGELOG.md b/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/CHANGELOG.md +++ b/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/_meta.json b/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/_meta.json index 3adb2523ec3e..f09cb8bd136b 100644 --- a/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/_meta.json +++ b/services/preview/digitaltwins/mgmt/2020-03-01-preview/digitaltwins/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md", "tag": "package-2020-03-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/CHANGELOG.md b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/_meta.json b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/_meta.json new file mode 100644 index 000000000000..8ab6754eff41 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", + "readme": "/_/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md", + "tag": "package-2021-06-30-preview", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2021-06-30-preview --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/digitaltwins/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/client.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/client.go new file mode 100644 index 000000000000..108df72940df --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/client.go @@ -0,0 +1,41 @@ +// Package digitaltwins implements the Azure ARM Digitaltwins service API version 2021-06-30-preview. +// +// Azure Digital Twins Client for managing DigitalTwinsInstance +package digitaltwins + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Digitaltwins + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Digitaltwins. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/digitaltwins.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/digitaltwins.go new file mode 100644 index 000000000000..d3616015b7a4 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/digitaltwins.go @@ -0,0 +1,716 @@ +package digitaltwins + +// 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" +) + +// Client is the azure Digital Twins Client for managing DigitalTwinsInstance +type Client struct { + BaseClient +} + +// NewClient creates an instance of the Client client. +func NewClient(subscriptionID string) Client { + return NewClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClientWithBaseURI creates an instance of the Client 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 NewClientWithBaseURI(baseURI string, subscriptionID string) Client { + return Client{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CheckNameAvailability check if a DigitalTwinsInstance name is available. +// Parameters: +// location - location of DigitalTwinsInstance. +// digitalTwinsInstanceCheckName - set the name parameter in the DigitalTwinsInstanceCheckName structure to the +// name of the DigitalTwinsInstance to check. +func (client Client) CheckNameAvailability(ctx context.Context, location string, digitalTwinsInstanceCheckName CheckNameRequest) (result CheckNameResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CheckNameAvailability") + 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: location, + Constraints: []validation.Constraint{{Target: "location", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: digitalTwinsInstanceCheckName, + Constraints: []validation.Constraint{{Target: "digitalTwinsInstanceCheckName.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "digitalTwinsInstanceCheckName.Type", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.Client", "CheckNameAvailability", err.Error()) + } + + req, err := client.CheckNameAvailabilityPreparer(ctx, location, digitalTwinsInstanceCheckName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CheckNameAvailability", nil, "Failure preparing request") + return + } + + resp, err := client.CheckNameAvailabilitySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CheckNameAvailability", resp, "Failure sending request") + return + } + + result, err = client.CheckNameAvailabilityResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CheckNameAvailability", resp, "Failure responding to request") + return + } + + return +} + +// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. +func (client Client) CheckNameAvailabilityPreparer(ctx context.Context, location string, digitalTwinsInstanceCheckName CheckNameRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/locations/{location}/checkNameAvailability", pathParameters), + autorest.WithJSON(digitalTwinsInstanceCheckName), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always +// closes the http.Response Body. +func (client Client) CheckNameAvailabilityResponder(resp *http.Response) (result CheckNameResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdate create or update the metadata of a DigitalTwinsInstance. The usual pattern to modify a property is to +// retrieve the DigitalTwinsInstance and security metadata, and then combine them with the modified values in a new +// body to update the DigitalTwinsInstance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// digitalTwinsCreate - the DigitalTwinsInstance and security metadata. +func (client Client) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsCreate Description) (result CreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.Client", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, digitalTwinsCreate) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client Client) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsCreate Description) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", pathParameters), + autorest.WithJSON(digitalTwinsCreate), + 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 Client) CreateOrUpdateSender(req *http.Request) (future CreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client Client) CreateOrUpdateResponder(resp *http.Response) (result Description, 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 DigitalTwinsInstance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +func (client Client) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result DeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.Client", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client Client) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}", 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 Client) DeleteSender(req *http.Request) (future DeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client Client) DeleteResponder(resp *http.Response) (result Description, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get DigitalTwinsInstances resource. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +func (client Client) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Description, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.Client", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client Client) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}", 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 Client) 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 Client) GetResponder(resp *http.Response) (result Description, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all the DigitalTwinsInstances in a subscription. +func (client Client) List(ctx context.Context) (result DescriptionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "List", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "List", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client Client) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DigitalTwins/digitalTwinsInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client Client) ListResponder(resp *http.Response) (result DescriptionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client Client) listNextResults(ctx context.Context, lastResults DescriptionListResult) (result DescriptionListResult, err error) { + req, err := lastResults.descriptionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListComplete(ctx context.Context) (result DescriptionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup get all the DigitalTwinsInstances in a resource group. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +func (client Client) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DescriptionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.dlr.Response.Response != nil { + sc = result.dlr.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}}}}); err != nil { + return result, validation.NewError("digitaltwins.Client", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dlr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dlr.hasNextLink() && result.dlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client Client) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client Client) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client Client) ListByResourceGroupResponder(resp *http.Response) (result DescriptionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client Client) listByResourceGroupNextResults(ctx context.Context, lastResults DescriptionListResult) (result DescriptionListResult, err error) { + req, err := lastResults.descriptionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "digitaltwins.Client", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client Client) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DescriptionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update update metadata of DigitalTwinsInstance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// digitalTwinsPatchDescription - the DigitalTwinsInstance and security metadata. +func (client Client) Update(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsPatchDescription PatchDescription) (result UpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.Client", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, digitalTwinsPatchDescription) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.Client", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client Client) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsPatchDescription PatchDescription) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}", pathParameters), + autorest.WithJSON(digitalTwinsPatchDescription), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateSender(req *http.Request) (future UpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client Client) UpdateResponder(resp *http.Response) (result Description, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/digitaltwinsapi/interfaces.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/digitaltwinsapi/interfaces.go new file mode 100644 index 000000000000..9237b0d02ce7 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/digitaltwinsapi/interfaces.go @@ -0,0 +1,75 @@ +package digitaltwinsapi + +// 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/azure-sdk-for-go/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins" +) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + CheckNameAvailability(ctx context.Context, location string, digitalTwinsInstanceCheckName digitaltwins.CheckNameRequest) (result digitaltwins.CheckNameResult, err error) + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsCreate digitaltwins.Description) (result digitaltwins.CreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.DeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.Description, err error) + List(ctx context.Context) (result digitaltwins.DescriptionListResultPage, err error) + ListComplete(ctx context.Context) (result digitaltwins.DescriptionListResultIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result digitaltwins.DescriptionListResultPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result digitaltwins.DescriptionListResultIterator, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, digitalTwinsPatchDescription digitaltwins.PatchDescription) (result digitaltwins.UpdateFuture, err error) +} + +var _ ClientAPI = (*digitaltwins.Client)(nil) + +// EndpointClientAPI contains the set of methods on the EndpointClient type. +type EndpointClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, endpointName string, endpointDescription digitaltwins.EndpointResource) (result digitaltwins.EndpointCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (result digitaltwins.EndpointDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (result digitaltwins.EndpointResource, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.EndpointResourceListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.EndpointResourceListResultIterator, err error) +} + +var _ EndpointClientAPI = (*digitaltwins.EndpointClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result digitaltwins.OperationListResultPage, err error) + ListComplete(ctx context.Context) (result digitaltwins.OperationListResultIterator, err error) +} + +var _ OperationsClientAPI = (*digitaltwins.OperationsClient)(nil) + +// PrivateLinkResourcesClientAPI contains the set of methods on the PrivateLinkResourcesClient type. +type PrivateLinkResourcesClientAPI interface { + Get(ctx context.Context, resourceGroupName string, resourceName string, resourceID string) (result digitaltwins.GroupIDInformation, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.GroupIDInformationResponse, err error) +} + +var _ PrivateLinkResourcesClientAPI = (*digitaltwins.PrivateLinkResourcesClient)(nil) + +// PrivateEndpointConnectionsClientAPI contains the set of methods on the PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection digitaltwins.PrivateEndpointConnection) (result digitaltwins.PrivateEndpointConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result digitaltwins.PrivateEndpointConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result digitaltwins.PrivateEndpointConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.PrivateEndpointConnectionsResponse, err error) +} + +var _ PrivateEndpointConnectionsClientAPI = (*digitaltwins.PrivateEndpointConnectionsClient)(nil) + +// TimeSeriesDatabaseConnectionsClientAPI contains the set of methods on the TimeSeriesDatabaseConnectionsClient type. +type TimeSeriesDatabaseConnectionsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string, timeSeriesDatabaseConnectionDescription digitaltwins.TimeSeriesDatabaseConnection) (result digitaltwins.TimeSeriesDatabaseConnectionsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string) (result digitaltwins.TimeSeriesDatabaseConnectionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string) (result digitaltwins.TimeSeriesDatabaseConnection, err error) + List(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.TimeSeriesDatabaseConnectionListResultPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result digitaltwins.TimeSeriesDatabaseConnectionListResultIterator, err error) +} + +var _ TimeSeriesDatabaseConnectionsClientAPI = (*digitaltwins.TimeSeriesDatabaseConnectionsClient)(nil) diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/endpoint.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/endpoint.go new file mode 100644 index 000000000000..905ec695ccd8 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/endpoint.go @@ -0,0 +1,442 @@ +package digitaltwins + +// 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" +) + +// EndpointClient is the azure Digital Twins Client for managing DigitalTwinsInstance +type EndpointClient struct { + BaseClient +} + +// NewEndpointClient creates an instance of the EndpointClient client. +func NewEndpointClient(subscriptionID string) EndpointClient { + return NewEndpointClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewEndpointClientWithBaseURI creates an instance of the EndpointClient 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 NewEndpointClientWithBaseURI(baseURI string, subscriptionID string) EndpointClient { + return EndpointClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update DigitalTwinsInstance endpoint. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// endpointName - name of Endpoint Resource. +// endpointDescription - the DigitalTwinsInstance endpoint metadata and security metadata. +func (client EndpointClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, endpointName string, endpointDescription EndpointResource) (result EndpointCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.MaxLength, Rule: 49, Chain: nil}, + {Target: "endpointName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.EndpointClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, endpointName, endpointDescription) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client EndpointClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, endpointName string, endpointDescription EndpointResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", pathParameters), + autorest.WithJSON(endpointDescription), + 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 EndpointClient) CreateOrUpdateSender(req *http.Request) (future EndpointCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client EndpointClient) CreateOrUpdateResponder(resp *http.Response) (result EndpointResource, 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 DigitalTwinsInstance endpoint. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// endpointName - name of Endpoint Resource. +func (client EndpointClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (result EndpointDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.MaxLength, Rule: 49, Chain: nil}, + {Target: "endpointName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.EndpointClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client EndpointClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", 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 EndpointClient) DeleteSender(req *http.Request) (future EndpointDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client EndpointClient) DeleteResponder(resp *http.Response) (result EndpointResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get DigitalTwinsInstances Endpoint. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// endpointName - name of Endpoint Resource. +func (client EndpointClient) Get(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (result EndpointResource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: endpointName, + Constraints: []validation.Constraint{{Target: "endpointName", Name: validation.MaxLength, Rule: 49, Chain: nil}, + {Target: "endpointName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.EndpointClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, endpointName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client EndpointClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, endpointName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "endpointName": autorest.Encode("path", endpointName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints/{endpointName}", 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 EndpointClient) 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 EndpointClient) GetResponder(resp *http.Response) (result EndpointResource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get DigitalTwinsInstance Endpoints. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +func (client EndpointClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result EndpointResourceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.List") + defer func() { + sc := -1 + if result.erlr.Response.Response != nil { + sc = result.erlr.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.EndpointClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.erlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "List", resp, "Failure sending request") + return + } + + result.erlr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "List", resp, "Failure responding to request") + return + } + if result.erlr.hasNextLink() && result.erlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client EndpointClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/endpoints", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client EndpointClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client EndpointClient) ListResponder(resp *http.Response) (result EndpointResourceListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client EndpointClient) listNextResults(ctx context.Context, lastResults EndpointResourceListResult) (result EndpointResourceListResult, err error) { + req, err := lastResults.endpointResourceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client EndpointClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result EndpointResourceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/enums.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/enums.go new file mode 100644 index 000000000000..f5117d901d94 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/enums.go @@ -0,0 +1,257 @@ +package digitaltwins + +// 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. + +// AuthenticationType enumerates the values for authentication type. +type AuthenticationType string + +const ( + // IdentityBased ... + IdentityBased AuthenticationType = "IdentityBased" + // KeyBased ... + KeyBased AuthenticationType = "KeyBased" +) + +// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. +func PossibleAuthenticationTypeValues() []AuthenticationType { + return []AuthenticationType{IdentityBased, KeyBased} +} + +// ConnectionPropertiesProvisioningState enumerates the values for connection properties provisioning state. +type ConnectionPropertiesProvisioningState string + +const ( + // Approved ... + Approved ConnectionPropertiesProvisioningState = "Approved" + // Disconnected ... + Disconnected ConnectionPropertiesProvisioningState = "Disconnected" + // Pending ... + Pending ConnectionPropertiesProvisioningState = "Pending" + // Rejected ... + Rejected ConnectionPropertiesProvisioningState = "Rejected" +) + +// PossibleConnectionPropertiesProvisioningStateValues returns an array of possible values for the ConnectionPropertiesProvisioningState const type. +func PossibleConnectionPropertiesProvisioningStateValues() []ConnectionPropertiesProvisioningState { + return []ConnectionPropertiesProvisioningState{Approved, Disconnected, Pending, Rejected} +} + +// ConnectionType enumerates the values for connection type. +type ConnectionType string + +const ( + // ConnectionTypeAzureDataExplorer ... + ConnectionTypeAzureDataExplorer ConnectionType = "AzureDataExplorer" + // ConnectionTypeTimeSeriesDatabaseConnectionProperties ... + ConnectionTypeTimeSeriesDatabaseConnectionProperties ConnectionType = "TimeSeriesDatabaseConnectionProperties" +) + +// PossibleConnectionTypeValues returns an array of possible values for the ConnectionType const type. +func PossibleConnectionTypeValues() []ConnectionType { + return []ConnectionType{ConnectionTypeAzureDataExplorer, ConnectionTypeTimeSeriesDatabaseConnectionProperties} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// EndpointProvisioningState enumerates the values for endpoint provisioning state. +type EndpointProvisioningState string + +const ( + // Canceled ... + Canceled EndpointProvisioningState = "Canceled" + // Deleted ... + Deleted EndpointProvisioningState = "Deleted" + // Deleting ... + Deleting EndpointProvisioningState = "Deleting" + // Disabled ... + Disabled EndpointProvisioningState = "Disabled" + // Failed ... + Failed EndpointProvisioningState = "Failed" + // Moving ... + Moving EndpointProvisioningState = "Moving" + // Provisioning ... + Provisioning EndpointProvisioningState = "Provisioning" + // Restoring ... + Restoring EndpointProvisioningState = "Restoring" + // Succeeded ... + Succeeded EndpointProvisioningState = "Succeeded" + // Suspending ... + Suspending EndpointProvisioningState = "Suspending" + // Warning ... + Warning EndpointProvisioningState = "Warning" +) + +// PossibleEndpointProvisioningStateValues returns an array of possible values for the EndpointProvisioningState const type. +func PossibleEndpointProvisioningStateValues() []EndpointProvisioningState { + return []EndpointProvisioningState{Canceled, Deleted, Deleting, Disabled, Failed, Moving, Provisioning, Restoring, Succeeded, Suspending, Warning} +} + +// EndpointType enumerates the values for endpoint type. +type EndpointType string + +const ( + // EndpointTypeDigitalTwinsEndpointResourceProperties ... + EndpointTypeDigitalTwinsEndpointResourceProperties EndpointType = "DigitalTwinsEndpointResourceProperties" + // EndpointTypeEventGrid ... + EndpointTypeEventGrid EndpointType = "EventGrid" + // EndpointTypeEventHub ... + EndpointTypeEventHub EndpointType = "EventHub" + // EndpointTypeServiceBus ... + EndpointTypeServiceBus EndpointType = "ServiceBus" +) + +// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. +func PossibleEndpointTypeValues() []EndpointType { + return []EndpointType{EndpointTypeDigitalTwinsEndpointResourceProperties, EndpointTypeEventGrid, EndpointTypeEventHub, EndpointTypeServiceBus} +} + +// IdentityType enumerates the values for identity type. +type IdentityType string + +const ( + // None ... + None IdentityType = "None" + // SystemAssigned ... + SystemAssigned IdentityType = "SystemAssigned" +) + +// PossibleIdentityTypeValues returns an array of possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{None, SystemAssigned} +} + +// PrivateLinkServiceConnectionStatus enumerates the values for private link service connection status. +type PrivateLinkServiceConnectionStatus string + +const ( + // PrivateLinkServiceConnectionStatusApproved ... + PrivateLinkServiceConnectionStatusApproved PrivateLinkServiceConnectionStatus = "Approved" + // PrivateLinkServiceConnectionStatusDisconnected ... + PrivateLinkServiceConnectionStatusDisconnected PrivateLinkServiceConnectionStatus = "Disconnected" + // PrivateLinkServiceConnectionStatusPending ... + PrivateLinkServiceConnectionStatusPending PrivateLinkServiceConnectionStatus = "Pending" + // PrivateLinkServiceConnectionStatusRejected ... + PrivateLinkServiceConnectionStatusRejected PrivateLinkServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateLinkServiceConnectionStatusValues returns an array of possible values for the PrivateLinkServiceConnectionStatus const type. +func PossiblePrivateLinkServiceConnectionStatusValues() []PrivateLinkServiceConnectionStatus { + return []PrivateLinkServiceConnectionStatus{PrivateLinkServiceConnectionStatusApproved, PrivateLinkServiceConnectionStatusDisconnected, PrivateLinkServiceConnectionStatusPending, PrivateLinkServiceConnectionStatusRejected} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleted ... + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateMoving ... + ProvisioningStateMoving ProvisioningState = "Moving" + // ProvisioningStateProvisioning ... + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateRestoring ... + ProvisioningStateRestoring ProvisioningState = "Restoring" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateSuspending ... + ProvisioningStateSuspending ProvisioningState = "Suspending" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateWarning ... + ProvisioningStateWarning ProvisioningState = "Warning" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateDeleted, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateMoving, ProvisioningStateProvisioning, ProvisioningStateRestoring, ProvisioningStateSucceeded, ProvisioningStateSuspending, ProvisioningStateUpdating, ProvisioningStateWarning} +} + +// PublicNetworkAccess enumerates the values for public network access. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled ... + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled ... + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns an array of possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{PublicNetworkAccessDisabled, PublicNetworkAccessEnabled} +} + +// Reason enumerates the values for reason. +type Reason string + +const ( + // AlreadyExists ... + AlreadyExists Reason = "AlreadyExists" + // Invalid ... + Invalid Reason = "Invalid" +) + +// PossibleReasonValues returns an array of possible values for the Reason const type. +func PossibleReasonValues() []Reason { + return []Reason{AlreadyExists, Invalid} +} + +// TimeSeriesDatabaseConnectionState enumerates the values for time series database connection state. +type TimeSeriesDatabaseConnectionState string + +const ( + // TimeSeriesDatabaseConnectionStateCanceled ... + TimeSeriesDatabaseConnectionStateCanceled TimeSeriesDatabaseConnectionState = "Canceled" + // TimeSeriesDatabaseConnectionStateDeleted ... + TimeSeriesDatabaseConnectionStateDeleted TimeSeriesDatabaseConnectionState = "Deleted" + // TimeSeriesDatabaseConnectionStateDeleting ... + TimeSeriesDatabaseConnectionStateDeleting TimeSeriesDatabaseConnectionState = "Deleting" + // TimeSeriesDatabaseConnectionStateDisabled ... + TimeSeriesDatabaseConnectionStateDisabled TimeSeriesDatabaseConnectionState = "Disabled" + // TimeSeriesDatabaseConnectionStateFailed ... + TimeSeriesDatabaseConnectionStateFailed TimeSeriesDatabaseConnectionState = "Failed" + // TimeSeriesDatabaseConnectionStateMoving ... + TimeSeriesDatabaseConnectionStateMoving TimeSeriesDatabaseConnectionState = "Moving" + // TimeSeriesDatabaseConnectionStateProvisioning ... + TimeSeriesDatabaseConnectionStateProvisioning TimeSeriesDatabaseConnectionState = "Provisioning" + // TimeSeriesDatabaseConnectionStateRestoring ... + TimeSeriesDatabaseConnectionStateRestoring TimeSeriesDatabaseConnectionState = "Restoring" + // TimeSeriesDatabaseConnectionStateSucceeded ... + TimeSeriesDatabaseConnectionStateSucceeded TimeSeriesDatabaseConnectionState = "Succeeded" + // TimeSeriesDatabaseConnectionStateSuspending ... + TimeSeriesDatabaseConnectionStateSuspending TimeSeriesDatabaseConnectionState = "Suspending" + // TimeSeriesDatabaseConnectionStateWarning ... + TimeSeriesDatabaseConnectionStateWarning TimeSeriesDatabaseConnectionState = "Warning" +) + +// PossibleTimeSeriesDatabaseConnectionStateValues returns an array of possible values for the TimeSeriesDatabaseConnectionState const type. +func PossibleTimeSeriesDatabaseConnectionStateValues() []TimeSeriesDatabaseConnectionState { + return []TimeSeriesDatabaseConnectionState{TimeSeriesDatabaseConnectionStateCanceled, TimeSeriesDatabaseConnectionStateDeleted, TimeSeriesDatabaseConnectionStateDeleting, TimeSeriesDatabaseConnectionStateDisabled, TimeSeriesDatabaseConnectionStateFailed, TimeSeriesDatabaseConnectionStateMoving, TimeSeriesDatabaseConnectionStateProvisioning, TimeSeriesDatabaseConnectionStateRestoring, TimeSeriesDatabaseConnectionStateSucceeded, TimeSeriesDatabaseConnectionStateSuspending, TimeSeriesDatabaseConnectionStateWarning} +} diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/models.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/models.go new file mode 100644 index 000000000000..435534414c93 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/models.go @@ -0,0 +1,2192 @@ +package digitaltwins + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins" + +// AzureDataExplorerConnectionProperties properties of a time series database connection to Azure Data +// Explorer with data being sent via an EventHub. +type AzureDataExplorerConnectionProperties struct { + // AdxResourceID - The resource ID of the Azure Data Explorer cluster. + AdxResourceID *string `json:"adxResourceId,omitempty"` + // AdxEndpointURI - The URI of the Azure Data Explorer endpoint. + AdxEndpointURI *string `json:"adxEndpointUri,omitempty"` + // AdxDatabaseName - The name of the Azure Data Explorer database. + AdxDatabaseName *string `json:"adxDatabaseName,omitempty"` + // AdxTableName - The name of the Azure Data Explorer table. + AdxTableName *string `json:"adxTableName,omitempty"` + // EventHubEndpointURI - The URL of the EventHub namespace for identity-based authentication. It must include the protocol sb:// + EventHubEndpointURI *string `json:"eventHubEndpointUri,omitempty"` + // EventHubEntityPath - The EventHub name in the EventHub namespace for identity-based authentication. + EventHubEntityPath *string `json:"eventHubEntityPath,omitempty"` + // EventHubNamespaceResourceID - The resource ID of the EventHub namespace. + EventHubNamespaceResourceID *string `json:"eventHubNamespaceResourceId,omitempty"` + // EventHubConsumerGroup - The EventHub consumer group to use when ADX reads from EventHub. Defaults to $Default. + EventHubConsumerGroup *string `json:"eventHubConsumerGroup,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'TimeSeriesDatabaseConnectionStateProvisioning', 'TimeSeriesDatabaseConnectionStateDeleting', 'TimeSeriesDatabaseConnectionStateSucceeded', 'TimeSeriesDatabaseConnectionStateFailed', 'TimeSeriesDatabaseConnectionStateCanceled', 'TimeSeriesDatabaseConnectionStateDeleted', 'TimeSeriesDatabaseConnectionStateWarning', 'TimeSeriesDatabaseConnectionStateSuspending', 'TimeSeriesDatabaseConnectionStateRestoring', 'TimeSeriesDatabaseConnectionStateMoving', 'TimeSeriesDatabaseConnectionStateDisabled' + ProvisioningState TimeSeriesDatabaseConnectionState `json:"provisioningState,omitempty"` + // ConnectionType - Possible values include: 'ConnectionTypeTimeSeriesDatabaseConnectionProperties', 'ConnectionTypeAzureDataExplorer' + ConnectionType ConnectionType `json:"connectionType,omitempty"` +} + +// MarshalJSON is the custom marshaler for AzureDataExplorerConnectionProperties. +func (adecp AzureDataExplorerConnectionProperties) MarshalJSON() ([]byte, error) { + adecp.ConnectionType = ConnectionTypeAzureDataExplorer + objectMap := make(map[string]interface{}) + if adecp.AdxResourceID != nil { + objectMap["adxResourceId"] = adecp.AdxResourceID + } + if adecp.AdxEndpointURI != nil { + objectMap["adxEndpointUri"] = adecp.AdxEndpointURI + } + if adecp.AdxDatabaseName != nil { + objectMap["adxDatabaseName"] = adecp.AdxDatabaseName + } + if adecp.AdxTableName != nil { + objectMap["adxTableName"] = adecp.AdxTableName + } + if adecp.EventHubEndpointURI != nil { + objectMap["eventHubEndpointUri"] = adecp.EventHubEndpointURI + } + if adecp.EventHubEntityPath != nil { + objectMap["eventHubEntityPath"] = adecp.EventHubEntityPath + } + if adecp.EventHubNamespaceResourceID != nil { + objectMap["eventHubNamespaceResourceId"] = adecp.EventHubNamespaceResourceID + } + if adecp.EventHubConsumerGroup != nil { + objectMap["eventHubConsumerGroup"] = adecp.EventHubConsumerGroup + } + if adecp.ConnectionType != "" { + objectMap["connectionType"] = adecp.ConnectionType + } + return json.Marshal(objectMap) +} + +// AsAzureDataExplorerConnectionProperties is the BasicTimeSeriesDatabaseConnectionProperties implementation for AzureDataExplorerConnectionProperties. +func (adecp AzureDataExplorerConnectionProperties) AsAzureDataExplorerConnectionProperties() (*AzureDataExplorerConnectionProperties, bool) { + return &adecp, true +} + +// AsTimeSeriesDatabaseConnectionProperties is the BasicTimeSeriesDatabaseConnectionProperties implementation for AzureDataExplorerConnectionProperties. +func (adecp AzureDataExplorerConnectionProperties) AsTimeSeriesDatabaseConnectionProperties() (*TimeSeriesDatabaseConnectionProperties, bool) { + return nil, false +} + +// AsBasicTimeSeriesDatabaseConnectionProperties is the BasicTimeSeriesDatabaseConnectionProperties implementation for AzureDataExplorerConnectionProperties. +func (adecp AzureDataExplorerConnectionProperties) AsBasicTimeSeriesDatabaseConnectionProperties() (BasicTimeSeriesDatabaseConnectionProperties, bool) { + return &adecp, true +} + +// CheckNameRequest the result returned from a database check name availability request. +type CheckNameRequest struct { + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - The type of resource, for instance Microsoft.DigitalTwins/digitalTwinsInstances. + Type *string `json:"type,omitempty"` +} + +// CheckNameResult the result returned from a check name availability request. +type CheckNameResult struct { + autorest.Response `json:"-"` + // NameAvailable - Specifies a Boolean value that indicates if the name is available. + NameAvailable *bool `json:"nameAvailable,omitempty"` + // Message - Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. + Message *string `json:"message,omitempty"` + // Reason - Message providing the reason why the given name is invalid. Possible values include: 'Invalid', 'AlreadyExists' + Reason Reason `json:"reason,omitempty"` +} + +// ConnectionProperties the properties of a private endpoint connection. +type ConnectionProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + ProvisioningState ConnectionPropertiesProvisioningState `json:"provisioningState,omitempty"` + // PrivateEndpoint - The private endpoint. + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + // GroupIds - The list of group ids for the private endpoint connection. + GroupIds *[]string `json:"groupIds,omitempty"` + // PrivateLinkServiceConnectionState - The connection state. + PrivateLinkServiceConnectionState *ConnectionPropertiesPrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ConnectionProperties. +func (cp ConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.PrivateEndpoint != nil { + objectMap["privateEndpoint"] = cp.PrivateEndpoint + } + if cp.GroupIds != nil { + objectMap["groupIds"] = cp.GroupIds + } + if cp.PrivateLinkServiceConnectionState != nil { + objectMap["privateLinkServiceConnectionState"] = cp.PrivateLinkServiceConnectionState + } + return json.Marshal(objectMap) +} + +// ConnectionPropertiesPrivateLinkServiceConnectionState the connection state. +type ConnectionPropertiesPrivateLinkServiceConnectionState struct { + // Status - The status of a private endpoint connection. Possible values include: 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + // Description - The description for the current state of a private endpoint connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - Actions required for a private endpoint connection. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// ConnectionState the current state of a private endpoint connection. +type ConnectionState struct { + // Status - The status of a private endpoint connection. Possible values include: 'PrivateLinkServiceConnectionStatusPending', 'PrivateLinkServiceConnectionStatusApproved', 'PrivateLinkServiceConnectionStatusRejected', 'PrivateLinkServiceConnectionStatusDisconnected' + Status PrivateLinkServiceConnectionStatus `json:"status,omitempty"` + // Description - The description for the current state of a private endpoint connection. + Description *string `json:"description,omitempty"` + // ActionsRequired - Actions required for a private endpoint connection. + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// CreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (Description, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for CreateOrUpdateFuture.Result. +func (future *CreateOrUpdateFuture) result(client Client) (d Description, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.CreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.CreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.CreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// DeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type DeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (Description, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *DeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for DeleteFuture.Result. +func (future *DeleteFuture) result(client Client) (d Description, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.DeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.DeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.DeleteResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.DeleteFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} + +// Description the description of the DigitalTwins service. +type Description struct { + autorest.Response `json:"-"` + // Properties - DigitalTwins instance properties. + *Properties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` + // Identity - The managed identity for the DigitalTwinsInstance. + Identity *Identity `json:"identity,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the DigitalTwinsInstance. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Description. +func (d Description) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.Properties != nil { + objectMap["properties"] = d.Properties + } + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + if d.Identity != nil { + objectMap["identity"] = d.Identity + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Description struct. +func (d *Description) 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 properties Properties + err = json.Unmarshal(*v, &properties) + if err != nil { + return err + } + d.Properties = &properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + d.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + d.SystemData = &systemData + } + } + } + + return nil +} + +// DescriptionListResult a list of DigitalTwins description objects with a next link. +type DescriptionListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of DigitalTwins description objects. + NextLink *string `json:"nextLink,omitempty"` + // Value - A list of DigitalTwins description objects. + Value *[]Description `json:"value,omitempty"` +} + +// DescriptionListResultIterator provides access to a complete listing of Description values. +type DescriptionListResultIterator struct { + i int + page DescriptionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DescriptionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DescriptionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DescriptionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DescriptionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DescriptionListResultIterator) Response() DescriptionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DescriptionListResultIterator) Value() Description { + if !iter.page.NotDone() { + return Description{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DescriptionListResultIterator type. +func NewDescriptionListResultIterator(page DescriptionListResultPage) DescriptionListResultIterator { + return DescriptionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dlr DescriptionListResult) IsEmpty() bool { + return dlr.Value == nil || len(*dlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dlr DescriptionListResult) hasNextLink() bool { + return dlr.NextLink != nil && len(*dlr.NextLink) != 0 +} + +// descriptionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dlr DescriptionListResult) descriptionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !dlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dlr.NextLink))) +} + +// DescriptionListResultPage contains a page of Description values. +type DescriptionListResultPage struct { + fn func(context.Context, DescriptionListResult) (DescriptionListResult, error) + dlr DescriptionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DescriptionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DescriptionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dlr) + if err != nil { + return err + } + page.dlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DescriptionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DescriptionListResultPage) NotDone() bool { + return !page.dlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DescriptionListResultPage) Response() DescriptionListResult { + return page.dlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DescriptionListResultPage) Values() []Description { + if page.dlr.IsEmpty() { + return nil + } + return *page.dlr.Value +} + +// Creates a new instance of the DescriptionListResultPage type. +func NewDescriptionListResultPage(cur DescriptionListResult, getNextPage func(context.Context, DescriptionListResult) (DescriptionListResult, error)) DescriptionListResultPage { + return DescriptionListResultPage{ + fn: getNextPage, + dlr: cur, + } +} + +// EndpointCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointClient) (EndpointResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointCreateOrUpdateFuture.Result. +func (future *EndpointCreateOrUpdateFuture) result(client EndpointClient) (er EndpointResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + er.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.EndpointCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if er.Response.Response, err = future.GetResult(sender); err == nil && er.Response.Response.StatusCode != http.StatusNoContent { + er, err = client.CreateOrUpdateResponder(er.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointCreateOrUpdateFuture", "Result", er.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type EndpointDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(EndpointClient) (EndpointResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *EndpointDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for EndpointDeleteFuture.Result. +func (future *EndpointDeleteFuture) result(client EndpointClient) (er EndpointResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + er.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.EndpointDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if er.Response.Response, err = future.GetResult(sender); err == nil && er.Response.Response.StatusCode != http.StatusNoContent { + er, err = client.DeleteResponder(er.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.EndpointDeleteFuture", "Result", er.Response.Response, "Failure responding to request") + } + } + return +} + +// EndpointResource digitalTwinsInstance endpoint resource. +type EndpointResource struct { + autorest.Response `json:"-"` + // Properties - DigitalTwinsInstance endpoint resource properties. + Properties BasicEndpointResourceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Extension resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for EndpointResource. +func (er EndpointResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = er.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EndpointResource struct. +func (er *EndpointResource) 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 { + properties, err := unmarshalBasicEndpointResourceProperties(*v) + if err != nil { + return err + } + er.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + er.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + er.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + er.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + er.SystemData = &systemData + } + } + } + + return nil +} + +// EndpointResourceListResult a list of DigitalTwinsInstance Endpoints with a next link. +type EndpointResourceListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of DigitalTwinsInstance Endpoints. + NextLink *string `json:"nextLink,omitempty"` + // Value - A list of DigitalTwinsInstance Endpoints. + Value *[]EndpointResource `json:"value,omitempty"` +} + +// EndpointResourceListResultIterator provides access to a complete listing of EndpointResource values. +type EndpointResourceListResultIterator struct { + i int + page EndpointResourceListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *EndpointResourceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *EndpointResourceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter EndpointResourceListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter EndpointResourceListResultIterator) Response() EndpointResourceListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter EndpointResourceListResultIterator) Value() EndpointResource { + if !iter.page.NotDone() { + return EndpointResource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the EndpointResourceListResultIterator type. +func NewEndpointResourceListResultIterator(page EndpointResourceListResultPage) EndpointResourceListResultIterator { + return EndpointResourceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (erlr EndpointResourceListResult) IsEmpty() bool { + return erlr.Value == nil || len(*erlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (erlr EndpointResourceListResult) hasNextLink() bool { + return erlr.NextLink != nil && len(*erlr.NextLink) != 0 +} + +// endpointResourceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (erlr EndpointResourceListResult) endpointResourceListResultPreparer(ctx context.Context) (*http.Request, error) { + if !erlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(erlr.NextLink))) +} + +// EndpointResourceListResultPage contains a page of EndpointResource values. +type EndpointResourceListResultPage struct { + fn func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error) + erlr EndpointResourceListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *EndpointResourceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EndpointResourceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.erlr) + if err != nil { + return err + } + page.erlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *EndpointResourceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page EndpointResourceListResultPage) NotDone() bool { + return !page.erlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page EndpointResourceListResultPage) Response() EndpointResourceListResult { + return page.erlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page EndpointResourceListResultPage) Values() []EndpointResource { + if page.erlr.IsEmpty() { + return nil + } + return *page.erlr.Value +} + +// Creates a new instance of the EndpointResourceListResultPage type. +func NewEndpointResourceListResultPage(cur EndpointResourceListResult, getNextPage func(context.Context, EndpointResourceListResult) (EndpointResourceListResult, error)) EndpointResourceListResultPage { + return EndpointResourceListResultPage{ + fn: getNextPage, + erlr: cur, + } +} + +// BasicEndpointResourceProperties properties related to Digital Twins Endpoint +type BasicEndpointResourceProperties interface { + AsServiceBus() (*ServiceBus, bool) + AsEventHub() (*EventHub, bool) + AsEventGrid() (*EventGrid, bool) + AsEndpointResourceProperties() (*EndpointResourceProperties, bool) +} + +// EndpointResourceProperties properties related to Digital Twins Endpoint +type EndpointResourceProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. + DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` + // DeadLetterURI - Dead letter storage URL for identity-based authentication. + DeadLetterURI *string `json:"deadLetterUri,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +func unmarshalBasicEndpointResourceProperties(body []byte) (BasicEndpointResourceProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["endpointType"] { + case string(EndpointTypeServiceBus): + var sb ServiceBus + err := json.Unmarshal(body, &sb) + return sb, err + case string(EndpointTypeEventHub): + var eh EventHub + err := json.Unmarshal(body, &eh) + return eh, err + case string(EndpointTypeEventGrid): + var eg EventGrid + err := json.Unmarshal(body, &eg) + return eg, err + default: + var erp EndpointResourceProperties + err := json.Unmarshal(body, &erp) + return erp, err + } +} +func unmarshalBasicEndpointResourcePropertiesArray(body []byte) ([]BasicEndpointResourceProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + erpArray := make([]BasicEndpointResourceProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + erp, err := unmarshalBasicEndpointResourceProperties(*rawMessage) + if err != nil { + return nil, err + } + erpArray[index] = erp + } + return erpArray, nil +} + +// MarshalJSON is the custom marshaler for EndpointResourceProperties. +func (erp EndpointResourceProperties) MarshalJSON() ([]byte, error) { + erp.EndpointType = EndpointTypeDigitalTwinsEndpointResourceProperties + objectMap := make(map[string]interface{}) + if erp.AuthenticationType != "" { + objectMap["authenticationType"] = erp.AuthenticationType + } + if erp.DeadLetterSecret != nil { + objectMap["deadLetterSecret"] = erp.DeadLetterSecret + } + if erp.DeadLetterURI != nil { + objectMap["deadLetterUri"] = erp.DeadLetterURI + } + if erp.EndpointType != "" { + objectMap["endpointType"] = erp.EndpointType + } + return json.Marshal(objectMap) +} + +// AsServiceBus is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. +func (erp EndpointResourceProperties) AsServiceBus() (*ServiceBus, bool) { + return nil, false +} + +// AsEventHub is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. +func (erp EndpointResourceProperties) AsEventHub() (*EventHub, bool) { + return nil, false +} + +// AsEventGrid is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. +func (erp EndpointResourceProperties) AsEventGrid() (*EventGrid, bool) { + return nil, false +} + +// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. +func (erp EndpointResourceProperties) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { + return &erp, true +} + +// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EndpointResourceProperties. +func (erp EndpointResourceProperties) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { + return &erp, true +} + +// ErrorDefinition error definition. +type ErrorDefinition struct { + // Code - READ-ONLY; Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; Description of the error. + Message *string `json:"message,omitempty"` + // Details - READ-ONLY; Internal error details. + Details *[]ErrorDefinition `json:"details,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDefinition. +func (ed ErrorDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse error response. +type ErrorResponse struct { + // Error - Error description + Error *ErrorDefinition `json:"error,omitempty"` +} + +// EventGrid properties related to EventGrid. +type EventGrid struct { + // TopicEndpoint - EventGrid Topic Endpoint. + TopicEndpoint *string `json:"TopicEndpoint,omitempty"` + // AccessKey1 - EventGrid secondary accesskey. Will be obfuscated during read. + AccessKey1 *string `json:"accessKey1,omitempty"` + // AccessKey2 - EventGrid secondary accesskey. Will be obfuscated during read. + AccessKey2 *string `json:"accessKey2,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. + DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` + // DeadLetterURI - Dead letter storage URL for identity-based authentication. + DeadLetterURI *string `json:"deadLetterUri,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventGrid. +func (eg EventGrid) MarshalJSON() ([]byte, error) { + eg.EndpointType = EndpointTypeEventGrid + objectMap := make(map[string]interface{}) + if eg.TopicEndpoint != nil { + objectMap["TopicEndpoint"] = eg.TopicEndpoint + } + if eg.AccessKey1 != nil { + objectMap["accessKey1"] = eg.AccessKey1 + } + if eg.AccessKey2 != nil { + objectMap["accessKey2"] = eg.AccessKey2 + } + if eg.AuthenticationType != "" { + objectMap["authenticationType"] = eg.AuthenticationType + } + if eg.DeadLetterSecret != nil { + objectMap["deadLetterSecret"] = eg.DeadLetterSecret + } + if eg.DeadLetterURI != nil { + objectMap["deadLetterUri"] = eg.DeadLetterURI + } + if eg.EndpointType != "" { + objectMap["endpointType"] = eg.EndpointType + } + return json.Marshal(objectMap) +} + +// AsServiceBus is the BasicEndpointResourceProperties implementation for EventGrid. +func (eg EventGrid) AsServiceBus() (*ServiceBus, bool) { + return nil, false +} + +// AsEventHub is the BasicEndpointResourceProperties implementation for EventGrid. +func (eg EventGrid) AsEventHub() (*EventHub, bool) { + return nil, false +} + +// AsEventGrid is the BasicEndpointResourceProperties implementation for EventGrid. +func (eg EventGrid) AsEventGrid() (*EventGrid, bool) { + return &eg, true +} + +// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventGrid. +func (eg EventGrid) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { + return nil, false +} + +// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventGrid. +func (eg EventGrid) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { + return &eg, true +} + +// EventHub properties related to EventHub. +type EventHub struct { + // ConnectionStringPrimaryKey - PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. + ConnectionStringPrimaryKey *string `json:"connectionStringPrimaryKey,omitempty"` + // ConnectionStringSecondaryKey - SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. + ConnectionStringSecondaryKey *string `json:"connectionStringSecondaryKey,omitempty"` + // EndpointURI - The URL of the EventHub namespace for identity-based authentication. It must include the protocol 'sb://'. + EndpointURI *string `json:"endpointUri,omitempty"` + // EntityPath - The EventHub name in the EventHub namespace for identity-based authentication. + EntityPath *string `json:"entityPath,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. + DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` + // DeadLetterURI - Dead letter storage URL for identity-based authentication. + DeadLetterURI *string `json:"deadLetterUri,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for EventHub. +func (eh EventHub) MarshalJSON() ([]byte, error) { + eh.EndpointType = EndpointTypeEventHub + objectMap := make(map[string]interface{}) + if eh.ConnectionStringPrimaryKey != nil { + objectMap["connectionStringPrimaryKey"] = eh.ConnectionStringPrimaryKey + } + if eh.ConnectionStringSecondaryKey != nil { + objectMap["connectionStringSecondaryKey"] = eh.ConnectionStringSecondaryKey + } + if eh.EndpointURI != nil { + objectMap["endpointUri"] = eh.EndpointURI + } + if eh.EntityPath != nil { + objectMap["entityPath"] = eh.EntityPath + } + if eh.AuthenticationType != "" { + objectMap["authenticationType"] = eh.AuthenticationType + } + if eh.DeadLetterSecret != nil { + objectMap["deadLetterSecret"] = eh.DeadLetterSecret + } + if eh.DeadLetterURI != nil { + objectMap["deadLetterUri"] = eh.DeadLetterURI + } + if eh.EndpointType != "" { + objectMap["endpointType"] = eh.EndpointType + } + return json.Marshal(objectMap) +} + +// AsServiceBus is the BasicEndpointResourceProperties implementation for EventHub. +func (eh EventHub) AsServiceBus() (*ServiceBus, bool) { + return nil, false +} + +// AsEventHub is the BasicEndpointResourceProperties implementation for EventHub. +func (eh EventHub) AsEventHub() (*EventHub, bool) { + return &eh, true +} + +// AsEventGrid is the BasicEndpointResourceProperties implementation for EventHub. +func (eh EventHub) AsEventGrid() (*EventGrid, bool) { + return nil, false +} + +// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventHub. +func (eh EventHub) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { + return nil, false +} + +// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for EventHub. +func (eh EventHub) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { + return &eh, true +} + +// ExternalResource definition of a resource. +type ExternalResource struct { + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Extension resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExternalResource. +func (er ExternalResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// GroupIDInformation the group information for creating a private endpoint on Digital Twin. +type GroupIDInformation struct { + autorest.Response `json:"-"` + // Properties - The group information properties. + Properties *GroupIDInformationProperties `json:"properties,omitempty"` + // ID - The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for GroupIDInformation. +func (gii GroupIDInformation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if gii.Properties != nil { + objectMap["properties"] = gii.Properties + } + if gii.ID != nil { + objectMap["id"] = gii.ID + } + return json.Marshal(objectMap) +} + +// GroupIDInformationProperties the properties for a group information object. +type GroupIDInformationProperties struct { + // GroupID - The group id. + GroupID *string `json:"groupId,omitempty"` + // RequiredMembers - The required members for a specific group id. + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + // RequiredZoneNames - The required DNS zones for a specific group id. + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} + +// GroupIDInformationResponse the available private link resources for a Digital Twin. +type GroupIDInformationResponse struct { + autorest.Response `json:"-"` + // Value - The list of available private link resources for a Digital Twin. + Value *[]GroupIDInformation `json:"value,omitempty"` +} + +// Identity the managed identity for the DigitalTwinsInstance. +type Identity struct { + // Type - The type of Managed Identity used by the DigitalTwinsInstance. Only SystemAssigned is supported. Possible values include: 'None', 'SystemAssigned' + Type IdentityType `json:"type,omitempty"` + // PrincipalID - READ-ONLY; The object id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-identity-principal-id header in the PUT request if the resource has a systemAssigned(implicit) identity + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant id of the Managed Identity Resource. This will be sent to the RP from ARM via the x-ms-client-tenant-id header in the PUT request if the resource has a systemAssigned(implicit) identity + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// Operation digitalTwins service REST API operation +type Operation struct { + // Name - READ-ONLY; Operation name: {provider}/{resource}/{read | write | action | delete} + Name *string `json:"name,omitempty"` + // Display - Operation properties display + Display *OperationDisplay `json:"display,omitempty"` + // Origin - READ-ONLY; The intended executor of the operation. + Origin *string `json:"origin,omitempty"` + // IsDataAction - READ-ONLY; If the operation is a data action (for data plane rbac). + IsDataAction *bool `json:"isDataAction,omitempty"` + // Properties - READ-ONLY; Operation properties. + Properties map[string]interface{} `json:"properties"` +} + +// MarshalJSON is the custom marshaler for Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.Display != nil { + objectMap["display"] = o.Display + } + return json.Marshal(objectMap) +} + +// OperationDisplay the object that represents the operation. +type OperationDisplay struct { + // Provider - READ-ONLY; Service provider: Microsoft DigitalTwins. + Provider *string `json:"provider,omitempty"` + // Resource - READ-ONLY; Resource Type: DigitalTwinsInstances. + Resource *string `json:"resource,omitempty"` + // Operation - READ-ONLY; Name of the operation. + Operation *string `json:"operation,omitempty"` + // Description - READ-ONLY; Friendly description for the operation. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationDisplay. +func (od OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationListResult a list of DigitalTwins service operations. It contains a list of operations and a +// URL link to get the next set of results. +type OperationListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of DigitalTwins description objects. + NextLink *string `json:"nextLink,omitempty"` + // Value - READ-ONLY; A list of DigitalTwins operations supported by the Microsoft.DigitalTwins resource provider. + Value *[]Operation `json:"value,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationListResult. +func (olr OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if olr.NextLink != nil { + objectMap["nextLink"] = olr.NextLink + } + return json.Marshal(objectMap) +} + +// OperationListResultIterator provides access to a complete listing of Operation values. +type OperationListResultIterator struct { + i int + page OperationListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationListResultIterator) Response() OperationListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationListResultIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationListResultIterator type. +func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { + return OperationListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (olr OperationListResult) IsEmpty() bool { + return olr.Value == nil || len(*olr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (olr OperationListResult) hasNextLink() bool { + return olr.NextLink != nil && len(*olr.NextLink) != 0 +} + +// operationListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) { + if !olr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(olr.NextLink))) +} + +// OperationListResultPage contains a page of Operation values. +type OperationListResultPage struct { + fn func(context.Context, OperationListResult) (OperationListResult, error) + olr OperationListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.olr) + if err != nil { + return err + } + page.olr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationListResultPage) NotDone() bool { + return !page.olr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationListResultPage) Response() OperationListResult { + return page.olr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationListResultPage) Values() []Operation { + if page.olr.IsEmpty() { + return nil + } + return *page.olr.Value +} + +// Creates a new instance of the OperationListResultPage type. +func NewOperationListResultPage(cur OperationListResult, getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage { + return OperationListResultPage{ + fn: getNextPage, + olr: cur, + } +} + +// PatchDescription the description of the DigitalTwins service. +type PatchDescription struct { + // Tags - Instance patch properties + Tags map[string]*string `json:"tags"` + // Identity - The managed identity for the DigitalTwinsInstance. + Identity *Identity `json:"identity,omitempty"` + // Properties - Properties for the DigitalTwinsInstance. + Properties *PatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchDescription. +func (pd PatchDescription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pd.Tags != nil { + objectMap["tags"] = pd.Tags + } + if pd.Identity != nil { + objectMap["identity"] = pd.Identity + } + if pd.Properties != nil { + objectMap["properties"] = pd.Properties + } + return json.Marshal(objectMap) +} + +// PatchProperties the properties of a DigitalTwinsInstance. +type PatchProperties struct { + // PublicNetworkAccess - Public network access for the DigitalTwinsInstance. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +// PrivateEndpoint the private endpoint property of a private endpoint connection. +type PrivateEndpoint struct { + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpoint. +func (peVar PrivateEndpoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// PrivateEndpointConnection the private endpoint connection of a Digital Twin. +type PrivateEndpointConnection struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Properties - The connection properties. + Properties *ConnectionProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the private endpoint connection. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.Properties != nil { + objectMap["properties"] = pec.Properties + } + return json.Marshal(objectMap) +} + +// PrivateEndpointConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type PrivateEndpointConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (PrivateEndpointConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsCreateOrUpdateFuture.Result. +func (future *PrivateEndpointConnectionsCreateOrUpdateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + pec.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.PrivateEndpointConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent { + pec, err = client.CreateOrUpdateResponder(pec.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsCreateOrUpdateFuture", "Result", pec.Response.Response, "Failure responding to request") + } + } + return +} + +// PrivateEndpointConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type PrivateEndpointConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(PrivateEndpointConnectionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *PrivateEndpointConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for PrivateEndpointConnectionsDeleteFuture.Result. +func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.PrivateEndpointConnectionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// PrivateEndpointConnectionsResponse the available private link connections for a Digital Twin. +type PrivateEndpointConnectionsResponse struct { + autorest.Response `json:"-"` + // Value - The list of available private link connections for a Digital Twin. + Value *[]PrivateEndpointConnection `json:"value,omitempty"` +} + +// Properties the properties of a DigitalTwinsInstance. +type Properties struct { + // CreatedTime - READ-ONLY; Time when DigitalTwinsInstance was created. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // LastUpdatedTime - READ-ONLY; Time when DigitalTwinsInstance was updated. + LastUpdatedTime *date.Time `json:"lastUpdatedTime,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'ProvisioningStateProvisioning', 'ProvisioningStateDeleting', 'ProvisioningStateUpdating', 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateDeleted', 'ProvisioningStateWarning', 'ProvisioningStateSuspending', 'ProvisioningStateRestoring', 'ProvisioningStateMoving' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // HostName - READ-ONLY; Api endpoint to work with DigitalTwinsInstance. + HostName *string `json:"hostName,omitempty"` + // PrivateEndpointConnections - The private endpoint connections. + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // PublicNetworkAccess - Public network access for the DigitalTwinsInstance. Possible values include: 'PublicNetworkAccessEnabled', 'PublicNetworkAccessDisabled' + PublicNetworkAccess PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` +} + +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.PrivateEndpointConnections != nil { + objectMap["privateEndpointConnections"] = p.PrivateEndpointConnections + } + if p.PublicNetworkAccess != "" { + objectMap["publicNetworkAccess"] = p.PublicNetworkAccess + } + return json.Marshal(objectMap) +} + +// Resource the common properties of a DigitalTwinsInstance. +type Resource struct { + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // Location - The resource location. + Location *string `json:"location,omitempty"` + // Tags - The resource tags. + Tags map[string]*string `json:"tags"` + // Identity - The managed identity for the DigitalTwinsInstance. + Identity *Identity `json:"identity,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the DigitalTwinsInstance. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Location != nil { + objectMap["location"] = r.Location + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + if r.Identity != nil { + objectMap["identity"] = r.Identity + } + return json.Marshal(objectMap) +} + +// ServiceBus properties related to ServiceBus. +type ServiceBus struct { + // PrimaryConnectionString - PrimaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. + PrimaryConnectionString *string `json:"primaryConnectionString,omitempty"` + // SecondaryConnectionString - SecondaryConnectionString of the endpoint for key-based authentication. Will be obfuscated during read. + SecondaryConnectionString *string `json:"secondaryConnectionString,omitempty"` + // EndpointURI - The URL of the ServiceBus namespace for identity-based authentication. It must include the protocol 'sb://'. + EndpointURI *string `json:"endpointUri,omitempty"` + // EntityPath - The ServiceBus Topic name for identity-based authentication. + EntityPath *string `json:"entityPath,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'Provisioning', 'Deleting', 'Succeeded', 'Failed', 'Canceled', 'Deleted', 'Warning', 'Suspending', 'Restoring', 'Moving', 'Disabled' + ProvisioningState EndpointProvisioningState `json:"provisioningState,omitempty"` + // CreatedTime - READ-ONLY; Time when the Endpoint was added to DigitalTwinsInstance. + CreatedTime *date.Time `json:"createdTime,omitempty"` + // AuthenticationType - Specifies the authentication type being used for connecting to the endpoint. Defaults to 'KeyBased'. If 'KeyBased' is selected, a connection string must be specified (at least the primary connection string). If 'IdentityBased' is select, the endpointUri and entityPath properties must be specified. Possible values include: 'KeyBased', 'IdentityBased' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // DeadLetterSecret - Dead letter storage secret for key-based authentication. Will be obfuscated during read. + DeadLetterSecret *string `json:"deadLetterSecret,omitempty"` + // DeadLetterURI - Dead letter storage URL for identity-based authentication. + DeadLetterURI *string `json:"deadLetterUri,omitempty"` + // EndpointType - Possible values include: 'EndpointTypeDigitalTwinsEndpointResourceProperties', 'EndpointTypeServiceBus', 'EndpointTypeEventHub', 'EndpointTypeEventGrid' + EndpointType EndpointType `json:"endpointType,omitempty"` +} + +// MarshalJSON is the custom marshaler for ServiceBus. +func (sb ServiceBus) MarshalJSON() ([]byte, error) { + sb.EndpointType = EndpointTypeServiceBus + objectMap := make(map[string]interface{}) + if sb.PrimaryConnectionString != nil { + objectMap["primaryConnectionString"] = sb.PrimaryConnectionString + } + if sb.SecondaryConnectionString != nil { + objectMap["secondaryConnectionString"] = sb.SecondaryConnectionString + } + if sb.EndpointURI != nil { + objectMap["endpointUri"] = sb.EndpointURI + } + if sb.EntityPath != nil { + objectMap["entityPath"] = sb.EntityPath + } + if sb.AuthenticationType != "" { + objectMap["authenticationType"] = sb.AuthenticationType + } + if sb.DeadLetterSecret != nil { + objectMap["deadLetterSecret"] = sb.DeadLetterSecret + } + if sb.DeadLetterURI != nil { + objectMap["deadLetterUri"] = sb.DeadLetterURI + } + if sb.EndpointType != "" { + objectMap["endpointType"] = sb.EndpointType + } + return json.Marshal(objectMap) +} + +// AsServiceBus is the BasicEndpointResourceProperties implementation for ServiceBus. +func (sb ServiceBus) AsServiceBus() (*ServiceBus, bool) { + return &sb, true +} + +// AsEventHub is the BasicEndpointResourceProperties implementation for ServiceBus. +func (sb ServiceBus) AsEventHub() (*EventHub, bool) { + return nil, false +} + +// AsEventGrid is the BasicEndpointResourceProperties implementation for ServiceBus. +func (sb ServiceBus) AsEventGrid() (*EventGrid, bool) { + return nil, false +} + +// AsEndpointResourceProperties is the BasicEndpointResourceProperties implementation for ServiceBus. +func (sb ServiceBus) AsEndpointResourceProperties() (*EndpointResourceProperties, bool) { + return nil, false +} + +// AsBasicEndpointResourceProperties is the BasicEndpointResourceProperties implementation for ServiceBus. +func (sb ServiceBus) AsBasicEndpointResourceProperties() (BasicEndpointResourceProperties, bool) { + return &sb, true +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TimeSeriesDatabaseConnection describes a time series database connection resource. +type TimeSeriesDatabaseConnection struct { + autorest.Response `json:"-"` + // Properties - Properties of a specific time series database connection. + Properties BasicTimeSeriesDatabaseConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The resource identifier. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Extension resource name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The resource type. + Type *string `json:"type,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for TimeSeriesDatabaseConnection. +func (tsdc TimeSeriesDatabaseConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["properties"] = tsdc.Properties + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for TimeSeriesDatabaseConnection struct. +func (tsdc *TimeSeriesDatabaseConnection) 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 { + properties, err := unmarshalBasicTimeSeriesDatabaseConnectionProperties(*v) + if err != nil { + return err + } + tsdc.Properties = properties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + tsdc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + tsdc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + tsdc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + tsdc.SystemData = &systemData + } + } + } + + return nil +} + +// TimeSeriesDatabaseConnectionListResult a pageable list of time series database connection resources. +type TimeSeriesDatabaseConnectionListResult struct { + autorest.Response `json:"-"` + // NextLink - The link used to get the next page of results. + NextLink *string `json:"nextLink,omitempty"` + // Value - A list of time series database connection resources. + Value *[]TimeSeriesDatabaseConnection `json:"value,omitempty"` +} + +// TimeSeriesDatabaseConnectionListResultIterator provides access to a complete listing of +// TimeSeriesDatabaseConnection values. +type TimeSeriesDatabaseConnectionListResultIterator struct { + i int + page TimeSeriesDatabaseConnectionListResultPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TimeSeriesDatabaseConnectionListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TimeSeriesDatabaseConnectionListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TimeSeriesDatabaseConnectionListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TimeSeriesDatabaseConnectionListResultIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TimeSeriesDatabaseConnectionListResultIterator) Response() TimeSeriesDatabaseConnectionListResult { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TimeSeriesDatabaseConnectionListResultIterator) Value() TimeSeriesDatabaseConnection { + if !iter.page.NotDone() { + return TimeSeriesDatabaseConnection{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TimeSeriesDatabaseConnectionListResultIterator type. +func NewTimeSeriesDatabaseConnectionListResultIterator(page TimeSeriesDatabaseConnectionListResultPage) TimeSeriesDatabaseConnectionListResultIterator { + return TimeSeriesDatabaseConnectionListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tsdclr TimeSeriesDatabaseConnectionListResult) IsEmpty() bool { + return tsdclr.Value == nil || len(*tsdclr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tsdclr TimeSeriesDatabaseConnectionListResult) hasNextLink() bool { + return tsdclr.NextLink != nil && len(*tsdclr.NextLink) != 0 +} + +// timeSeriesDatabaseConnectionListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tsdclr TimeSeriesDatabaseConnectionListResult) timeSeriesDatabaseConnectionListResultPreparer(ctx context.Context) (*http.Request, error) { + if !tsdclr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tsdclr.NextLink))) +} + +// TimeSeriesDatabaseConnectionListResultPage contains a page of TimeSeriesDatabaseConnection values. +type TimeSeriesDatabaseConnectionListResultPage struct { + fn func(context.Context, TimeSeriesDatabaseConnectionListResult) (TimeSeriesDatabaseConnectionListResult, error) + tsdclr TimeSeriesDatabaseConnectionListResult +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TimeSeriesDatabaseConnectionListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TimeSeriesDatabaseConnectionListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tsdclr) + if err != nil { + return err + } + page.tsdclr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TimeSeriesDatabaseConnectionListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TimeSeriesDatabaseConnectionListResultPage) NotDone() bool { + return !page.tsdclr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TimeSeriesDatabaseConnectionListResultPage) Response() TimeSeriesDatabaseConnectionListResult { + return page.tsdclr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TimeSeriesDatabaseConnectionListResultPage) Values() []TimeSeriesDatabaseConnection { + if page.tsdclr.IsEmpty() { + return nil + } + return *page.tsdclr.Value +} + +// Creates a new instance of the TimeSeriesDatabaseConnectionListResultPage type. +func NewTimeSeriesDatabaseConnectionListResultPage(cur TimeSeriesDatabaseConnectionListResult, getNextPage func(context.Context, TimeSeriesDatabaseConnectionListResult) (TimeSeriesDatabaseConnectionListResult, error)) TimeSeriesDatabaseConnectionListResultPage { + return TimeSeriesDatabaseConnectionListResultPage{ + fn: getNextPage, + tsdclr: cur, + } +} + +// BasicTimeSeriesDatabaseConnectionProperties properties of a time series database connection resource. +type BasicTimeSeriesDatabaseConnectionProperties interface { + AsAzureDataExplorerConnectionProperties() (*AzureDataExplorerConnectionProperties, bool) + AsTimeSeriesDatabaseConnectionProperties() (*TimeSeriesDatabaseConnectionProperties, bool) +} + +// TimeSeriesDatabaseConnectionProperties properties of a time series database connection resource. +type TimeSeriesDatabaseConnectionProperties struct { + // ProvisioningState - READ-ONLY; The provisioning state. Possible values include: 'TimeSeriesDatabaseConnectionStateProvisioning', 'TimeSeriesDatabaseConnectionStateDeleting', 'TimeSeriesDatabaseConnectionStateSucceeded', 'TimeSeriesDatabaseConnectionStateFailed', 'TimeSeriesDatabaseConnectionStateCanceled', 'TimeSeriesDatabaseConnectionStateDeleted', 'TimeSeriesDatabaseConnectionStateWarning', 'TimeSeriesDatabaseConnectionStateSuspending', 'TimeSeriesDatabaseConnectionStateRestoring', 'TimeSeriesDatabaseConnectionStateMoving', 'TimeSeriesDatabaseConnectionStateDisabled' + ProvisioningState TimeSeriesDatabaseConnectionState `json:"provisioningState,omitempty"` + // ConnectionType - Possible values include: 'ConnectionTypeTimeSeriesDatabaseConnectionProperties', 'ConnectionTypeAzureDataExplorer' + ConnectionType ConnectionType `json:"connectionType,omitempty"` +} + +func unmarshalBasicTimeSeriesDatabaseConnectionProperties(body []byte) (BasicTimeSeriesDatabaseConnectionProperties, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["connectionType"] { + case string(ConnectionTypeAzureDataExplorer): + var adecp AzureDataExplorerConnectionProperties + err := json.Unmarshal(body, &adecp) + return adecp, err + default: + var tsdcp TimeSeriesDatabaseConnectionProperties + err := json.Unmarshal(body, &tsdcp) + return tsdcp, err + } +} +func unmarshalBasicTimeSeriesDatabaseConnectionPropertiesArray(body []byte) ([]BasicTimeSeriesDatabaseConnectionProperties, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + tsdcpArray := make([]BasicTimeSeriesDatabaseConnectionProperties, len(rawMessages)) + + for index, rawMessage := range rawMessages { + tsdcp, err := unmarshalBasicTimeSeriesDatabaseConnectionProperties(*rawMessage) + if err != nil { + return nil, err + } + tsdcpArray[index] = tsdcp + } + return tsdcpArray, nil +} + +// MarshalJSON is the custom marshaler for TimeSeriesDatabaseConnectionProperties. +func (tsdcp TimeSeriesDatabaseConnectionProperties) MarshalJSON() ([]byte, error) { + tsdcp.ConnectionType = ConnectionTypeTimeSeriesDatabaseConnectionProperties + objectMap := make(map[string]interface{}) + if tsdcp.ConnectionType != "" { + objectMap["connectionType"] = tsdcp.ConnectionType + } + return json.Marshal(objectMap) +} + +// AsAzureDataExplorerConnectionProperties is the BasicTimeSeriesDatabaseConnectionProperties implementation for TimeSeriesDatabaseConnectionProperties. +func (tsdcp TimeSeriesDatabaseConnectionProperties) AsAzureDataExplorerConnectionProperties() (*AzureDataExplorerConnectionProperties, bool) { + return nil, false +} + +// AsTimeSeriesDatabaseConnectionProperties is the BasicTimeSeriesDatabaseConnectionProperties implementation for TimeSeriesDatabaseConnectionProperties. +func (tsdcp TimeSeriesDatabaseConnectionProperties) AsTimeSeriesDatabaseConnectionProperties() (*TimeSeriesDatabaseConnectionProperties, bool) { + return &tsdcp, true +} + +// AsBasicTimeSeriesDatabaseConnectionProperties is the BasicTimeSeriesDatabaseConnectionProperties implementation for TimeSeriesDatabaseConnectionProperties. +func (tsdcp TimeSeriesDatabaseConnectionProperties) AsBasicTimeSeriesDatabaseConnectionProperties() (BasicTimeSeriesDatabaseConnectionProperties, bool) { + return &tsdcp, true +} + +// TimeSeriesDatabaseConnectionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the +// results of a long-running operation. +type TimeSeriesDatabaseConnectionsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TimeSeriesDatabaseConnectionsClient) (TimeSeriesDatabaseConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TimeSeriesDatabaseConnectionsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for TimeSeriesDatabaseConnectionsCreateOrUpdateFuture.Result. +func (future *TimeSeriesDatabaseConnectionsCreateOrUpdateFuture) result(client TimeSeriesDatabaseConnectionsClient) (tsdc TimeSeriesDatabaseConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tsdc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.TimeSeriesDatabaseConnectionsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tsdc.Response.Response, err = future.GetResult(sender); err == nil && tsdc.Response.Response.StatusCode != http.StatusNoContent { + tsdc, err = client.CreateOrUpdateResponder(tsdc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsCreateOrUpdateFuture", "Result", tsdc.Response.Response, "Failure responding to request") + } + } + return +} + +// TimeSeriesDatabaseConnectionsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type TimeSeriesDatabaseConnectionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TimeSeriesDatabaseConnectionsClient) (TimeSeriesDatabaseConnection, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *TimeSeriesDatabaseConnectionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for TimeSeriesDatabaseConnectionsDeleteFuture.Result. +func (future *TimeSeriesDatabaseConnectionsDeleteFuture) result(client TimeSeriesDatabaseConnectionsClient) (tsdc TimeSeriesDatabaseConnection, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + tsdc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.TimeSeriesDatabaseConnectionsDeleteFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tsdc.Response.Response, err = future.GetResult(sender); err == nil && tsdc.Response.Response.StatusCode != http.StatusNoContent { + tsdc, err = client.DeleteResponder(tsdc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsDeleteFuture", "Result", tsdc.Response.Response, "Failure responding to request") + } + } + return +} + +// UpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(Client) (Description, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *UpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for UpdateFuture.Result. +func (future *UpdateFuture) result(client Client) (d Description, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.UpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + d.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("digitaltwins.UpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.UpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.UpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/operations.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/operations.go similarity index 79% rename from services/preview/appinsights/mgmt/2020-02-02-preview/insights/operations.go rename to services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/operations.go index b7459628872f..a3978f832358 100644 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/operations.go +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/operations.go @@ -1,4 +1,4 @@ -package insights +package digitaltwins // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. @@ -14,7 +14,7 @@ import ( "net/http" ) -// OperationsClient is the composite Swagger for Application Insights Management Client +// OperationsClient is the azure Digital Twins Client for managing DigitalTwinsInstance type OperationsClient struct { BaseClient } @@ -30,7 +30,7 @@ func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) Opera return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// List lists all of the available insights REST API operations. +// List lists all of the available DigitalTwins service REST API operations. func (client OperationsClient) List(ctx context.Context) (result OperationListResultPage, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") @@ -45,20 +45,20 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe result.fn = client.listNextResults req, err := client.ListPreparer(ctx) if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "List", nil, "Failure preparing request") return } resp, err := client.ListSender(req) if err != nil { result.olr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "List", resp, "Failure sending request") return } result.olr, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "List", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "List", resp, "Failure responding to request") return } if result.olr.hasNextLink() && result.olr.IsEmpty() { @@ -71,7 +71,7 @@ func (client OperationsClient) List(ctx context.Context) (result OperationListRe // ListPreparer prepares the List request. func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2015-05-01" + const APIVersion = "2021-06-30-preview" queryParameters := map[string]interface{}{ "api-version": APIVersion, } @@ -79,7 +79,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, preparer := autorest.CreatePreparer( autorest.AsGet(), autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.Insights/operations"), + autorest.WithPath("/providers/Microsoft.DigitalTwins/operations"), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } @@ -106,7 +106,7 @@ func (client OperationsClient) ListResponder(resp *http.Response) (result Operat func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationListResult) (result OperationListResult, err error) { req, err := lastResults.operationListResultPreparer(ctx) if err != nil { - return result, autorest.NewErrorWithError(err, "insights.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + return result, autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "listNextResults", nil, "Failure preparing next results request") } if req == nil { return @@ -114,11 +114,11 @@ func (client OperationsClient) listNextResults(ctx context.Context, lastResults resp, err := client.ListSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "insights.OperationsClient", "listNextResults", resp, "Failure sending next results request") + return result, autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "listNextResults", resp, "Failure sending next results request") } result, err = client.ListResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "insights.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + err = autorest.NewErrorWithError(err, "digitaltwins.OperationsClient", "listNextResults", resp, "Failure responding to next results request") } return } diff --git a/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/privateendpointconnections.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/privateendpointconnections.go new file mode 100644 index 000000000000..cd822190f06f --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/privateendpointconnections.go @@ -0,0 +1,397 @@ +package digitaltwins + +// 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" +) + +// PrivateEndpointConnectionsClient is the azure Digital Twins Client for managing DigitalTwinsInstance +type PrivateEndpointConnectionsClient struct { + BaseClient +} + +// NewPrivateEndpointConnectionsClient creates an instance of the PrivateEndpointConnectionsClient client. +func NewPrivateEndpointConnectionsClient(subscriptionID string) PrivateEndpointConnectionsClient { + return NewPrivateEndpointConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateEndpointConnectionsClientWithBaseURI creates an instance of the PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClientWithBaseURI(baseURI string, subscriptionID string) PrivateEndpointConnectionsClient { + return PrivateEndpointConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate update the status of a private endpoint connection with the given name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// privateEndpointConnectionName - the name of the private endpoint connection. +// privateEndpointConnection - the private endpoint connection with updated properties. +func (client PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (result PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: privateEndpointConnection, + Constraints: []validation.Constraint{{Target: "privateEndpointConnection.Properties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client PrivateEndpointConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + privateEndpointConnection.ID = nil + privateEndpointConnection.Name = nil + privateEndpointConnection.Type = nil + privateEndpointConnection.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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", pathParameters), + autorest.WithJSON(privateEndpointConnection), + 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 PrivateEndpointConnectionsClient) CreateOrUpdateSender(req *http.Request) (future PrivateEndpointConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete private endpoint connection with the specified name. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client PrivateEndpointConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) DeleteSender(req *http.Request) (future PrivateEndpointConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get private endpoint connection properties for the given private endpoint. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// privateEndpointConnectionName - the name of the private endpoint connection. +func (client PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (result PrivateEndpointConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, privateEndpointConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateEndpointConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, privateEndpointConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "privateEndpointConnectionName": autorest.Encode("path", privateEndpointConnectionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", 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 PrivateEndpointConnectionsClient) 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 PrivateEndpointConnectionsClient) GetResponder(resp *http.Response) (result PrivateEndpointConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private endpoint connection properties. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +func (client PrivateEndpointConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result PrivateEndpointConnectionsResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateEndpointConnectionsClient.List") + 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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.PrivateEndpointConnectionsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateEndpointConnectionsClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateEndpointConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateEndpointConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateEndpointConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateEndpointConnectionsClient) ListResponder(resp *http.Response) (result PrivateEndpointConnectionsResponse, 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/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/privatelinkresources.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/privatelinkresources.go new file mode 100644 index 000000000000..2c77f07a9c23 --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/privatelinkresources.go @@ -0,0 +1,207 @@ +package digitaltwins + +// 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" +) + +// PrivateLinkResourcesClient is the azure Digital Twins Client for managing DigitalTwinsInstance +type PrivateLinkResourcesClient struct { + BaseClient +} + +// NewPrivateLinkResourcesClient creates an instance of the PrivateLinkResourcesClient client. +func NewPrivateLinkResourcesClient(subscriptionID string) PrivateLinkResourcesClient { + return NewPrivateLinkResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPrivateLinkResourcesClientWithBaseURI creates an instance of the PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClientWithBaseURI(baseURI string, subscriptionID string) PrivateLinkResourcesClient { + return PrivateLinkResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the specified private link resource for the given Digital Twin. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// resourceID - the name of the private link resource. +func (client PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, resourceID string) (result GroupIDInformation, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.PrivateLinkResourcesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, resourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client PrivateLinkResourcesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, resourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceId": autorest.Encode("path", resourceID), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources/{resourceId}", 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 PrivateLinkResourcesClient) 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 PrivateLinkResourcesClient) GetResponder(resp *http.Response) (result GroupIDInformation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list private link resources for given Digital Twin. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +func (client PrivateLinkResourcesClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result GroupIDInformationResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PrivateLinkResourcesClient.List") + 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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.PrivateLinkResourcesClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.PrivateLinkResourcesClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client PrivateLinkResourcesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/privateLinkResources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client PrivateLinkResourcesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client PrivateLinkResourcesClient) ListResponder(resp *http.Response) (result GroupIDInformationResponse, 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/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/timeseriesdatabaseconnections.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/timeseriesdatabaseconnections.go new file mode 100644 index 000000000000..f85a190df7fb --- /dev/null +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/timeseriesdatabaseconnections.go @@ -0,0 +1,443 @@ +package digitaltwins + +// 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" +) + +// TimeSeriesDatabaseConnectionsClient is the azure Digital Twins Client for managing DigitalTwinsInstance +type TimeSeriesDatabaseConnectionsClient struct { + BaseClient +} + +// NewTimeSeriesDatabaseConnectionsClient creates an instance of the TimeSeriesDatabaseConnectionsClient client. +func NewTimeSeriesDatabaseConnectionsClient(subscriptionID string) TimeSeriesDatabaseConnectionsClient { + return NewTimeSeriesDatabaseConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTimeSeriesDatabaseConnectionsClientWithBaseURI creates an instance of the TimeSeriesDatabaseConnectionsClient +// 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 NewTimeSeriesDatabaseConnectionsClientWithBaseURI(baseURI string, subscriptionID string) TimeSeriesDatabaseConnectionsClient { + return TimeSeriesDatabaseConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a time series database connection. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// timeSeriesDatabaseConnectionName - name of time series database connection. +// timeSeriesDatabaseConnectionDescription - the time series database connection description. +func (client TimeSeriesDatabaseConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string, timeSeriesDatabaseConnectionDescription TimeSeriesDatabaseConnection) (result TimeSeriesDatabaseConnectionsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TimeSeriesDatabaseConnectionsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: timeSeriesDatabaseConnectionName, + Constraints: []validation.Constraint{{Target: "timeSeriesDatabaseConnectionName", Name: validation.MaxLength, Rule: 49, Chain: nil}, + {Target: "timeSeriesDatabaseConnectionName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.TimeSeriesDatabaseConnectionsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, timeSeriesDatabaseConnectionName, timeSeriesDatabaseConnectionDescription) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TimeSeriesDatabaseConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string, timeSeriesDatabaseConnectionDescription TimeSeriesDatabaseConnection) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "timeSeriesDatabaseConnectionName": autorest.Encode("path", timeSeriesDatabaseConnectionName), + } + + const APIVersion = "2021-06-30-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName}", pathParameters), + autorest.WithJSON(timeSeriesDatabaseConnectionDescription), + 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 TimeSeriesDatabaseConnectionsClient) CreateOrUpdateSender(req *http.Request) (future TimeSeriesDatabaseConnectionsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TimeSeriesDatabaseConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result TimeSeriesDatabaseConnection, 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 time series database connection. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// timeSeriesDatabaseConnectionName - name of time series database connection. +func (client TimeSeriesDatabaseConnectionsClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string) (result TimeSeriesDatabaseConnectionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TimeSeriesDatabaseConnectionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: timeSeriesDatabaseConnectionName, + Constraints: []validation.Constraint{{Target: "timeSeriesDatabaseConnectionName", Name: validation.MaxLength, Rule: 49, Chain: nil}, + {Target: "timeSeriesDatabaseConnectionName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.TimeSeriesDatabaseConnectionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, timeSeriesDatabaseConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TimeSeriesDatabaseConnectionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "timeSeriesDatabaseConnectionName": autorest.Encode("path", timeSeriesDatabaseConnectionName), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName}", 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 TimeSeriesDatabaseConnectionsClient) DeleteSender(req *http.Request) (future TimeSeriesDatabaseConnectionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TimeSeriesDatabaseConnectionsClient) DeleteResponder(resp *http.Response) (result TimeSeriesDatabaseConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get the description of an existing time series database connection. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +// timeSeriesDatabaseConnectionName - name of time series database connection. +func (client TimeSeriesDatabaseConnectionsClient) Get(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string) (result TimeSeriesDatabaseConnection, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TimeSeriesDatabaseConnectionsClient.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}, + {TargetValue: timeSeriesDatabaseConnectionName, + Constraints: []validation.Constraint{{Target: "timeSeriesDatabaseConnectionName", Name: validation.MaxLength, Rule: 49, Chain: nil}, + {Target: "timeSeriesDatabaseConnectionName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.TimeSeriesDatabaseConnectionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, timeSeriesDatabaseConnectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TimeSeriesDatabaseConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, timeSeriesDatabaseConnectionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "timeSeriesDatabaseConnectionName": autorest.Encode("path", timeSeriesDatabaseConnectionName), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections/{timeSeriesDatabaseConnectionName}", 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 TimeSeriesDatabaseConnectionsClient) 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 TimeSeriesDatabaseConnectionsClient) GetResponder(resp *http.Response) (result TimeSeriesDatabaseConnection, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List get all existing time series database connections for this DigitalTwins instance. +// Parameters: +// resourceGroupName - the name of the resource group that contains the DigitalTwinsInstance. +// resourceName - the name of the DigitalTwinsInstance. +func (client TimeSeriesDatabaseConnectionsClient) List(ctx context.Context, resourceGroupName string, resourceName string) (result TimeSeriesDatabaseConnectionListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TimeSeriesDatabaseConnectionsClient.List") + defer func() { + sc := -1 + if result.tsdclr.Response.Response != nil { + sc = result.tsdclr.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: resourceName, + Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 63, Chain: nil}, + {Target: "resourceName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil { + return result, validation.NewError("digitaltwins.TimeSeriesDatabaseConnectionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.tsdclr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "List", resp, "Failure sending request") + return + } + + result.tsdclr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "List", resp, "Failure responding to request") + return + } + if result.tsdclr.hasNextLink() && result.tsdclr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client TimeSeriesDatabaseConnectionsClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-06-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.DigitalTwins/digitalTwinsInstances/{resourceName}/timeSeriesDatabaseConnections", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client TimeSeriesDatabaseConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client TimeSeriesDatabaseConnectionsClient) ListResponder(resp *http.Response) (result TimeSeriesDatabaseConnectionListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client TimeSeriesDatabaseConnectionsClient) listNextResults(ctx context.Context, lastResults TimeSeriesDatabaseConnectionListResult) (result TimeSeriesDatabaseConnectionListResult, err error) { + req, err := lastResults.timeSeriesDatabaseConnectionListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "digitaltwins.TimeSeriesDatabaseConnectionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client TimeSeriesDatabaseConnectionsClient) ListComplete(ctx context.Context, resourceGroupName string, resourceName string) (result TimeSeriesDatabaseConnectionListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TimeSeriesDatabaseConnectionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, resourceName) + return +} diff --git a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/version.go b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/version.go similarity index 85% rename from services/preview/appinsights/mgmt/2020-02-02-preview/insights/version.go rename to services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/version.go index 531d11c5c18a..1ca36c2fccb6 100644 --- a/services/preview/appinsights/mgmt/2020-02-02-preview/insights/version.go +++ b/services/preview/digitaltwins/mgmt/2021-06-30-preview/digitaltwins/version.go @@ -1,4 +1,4 @@ -package insights +package digitaltwins import "github.com/Azure/azure-sdk-for-go/version" @@ -10,7 +10,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " insights/2020-02-02-preview" + return "Azure-SDK-For-Go/" + Version() + " digitaltwins/2021-06-30-preview" } // Version returns the semantic version (see http://semver.org) of the client. diff --git a/services/preview/dns/mgmt/2015-05-04-preview/dns/CHANGELOG.md b/services/preview/dns/mgmt/2015-05-04-preview/dns/CHANGELOG.md index 52911e4cc5e4..bcd5b6bd3eae 100644 --- a/services/preview/dns/mgmt/2015-05-04-preview/dns/CHANGELOG.md +++ b/services/preview/dns/mgmt/2015-05-04-preview/dns/CHANGELOG.md @@ -1,2 +1,32 @@ -# Change History +# Unreleased +## Breaking Changes + +### Struct Changes + +#### Removed Struct Fields + +1. RecordSet.Location +1. RecordSet.Properties +1. RecordSet.Tags + +## Additive Changes + +### New Funcs + +1. *RecordSet.UnmarshalJSON([]byte) error +1. RecordSetProperties.MarshalJSON() ([]byte, error) +1. ZoneProperties.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. CloudError +1. CloudErrorBody + +#### New Struct Fields + +1. RecordSet.*RecordSetProperties +1. RecordSetProperties.Fqdn +1. ZoneProperties.MaxNumberOfRecordsPerRecordSet diff --git a/services/preview/dns/mgmt/2015-05-04-preview/dns/_meta.json b/services/preview/dns/mgmt/2015-05-04-preview/dns/_meta.json index 8d8767712fb5..dc6da179df98 100644 --- a/services/preview/dns/mgmt/2015-05-04-preview/dns/_meta.json +++ b/services/preview/dns/mgmt/2015-05-04-preview/dns/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", "tag": "package-2015-05-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/dns/mgmt/2015-05-04-preview/dns/models.go b/services/preview/dns/mgmt/2015-05-04-preview/dns/models.go index 57487777640a..6bed790088e7 100644 --- a/services/preview/dns/mgmt/2015-05-04-preview/dns/models.go +++ b/services/preview/dns/mgmt/2015-05-04-preview/dns/models.go @@ -48,6 +48,24 @@ func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// CloudError an error response from the service. +type CloudError struct { + // Error - Cloud error body. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Target - The target of the particular error. For example, the name of the property in error. + Target *string `json:"target,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + // CnameRecord a CNAME record. type CnameRecord struct { // Cname - Gets or sets the canonical name for this record without a terminating dot. @@ -91,23 +109,19 @@ type PtrRecord struct { Ptrdname *string `json:"ptrdname,omitempty"` } -// RecordSet describes a DNS RecordSet (a set of DNS records with the same name and type). +// RecordSet describes a DNS record set (a collection of DNS records with the same name and type). type RecordSet struct { autorest.Response `json:"-"` - // Etag - Gets or sets the ETag of the RecordSet. - Etag *string `json:"etag,omitempty"` - // Properties - Gets or sets the properties of the RecordSet. - Properties *RecordSetProperties `json:"properties,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // ID - READ-ONLY; The ID of the record set. ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource + // Name - READ-ONLY; The name of the record set. Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + // Type - READ-ONLY; The type of the record set. Type *string `json:"type,omitempty"` + // Etag - The etag of the record set. + Etag *string `json:"etag,omitempty"` + // RecordSetProperties - The properties of the record set. + *RecordSetProperties `json:"properties,omitempty"` } // MarshalJSON is the custom marshaler for RecordSet. @@ -116,16 +130,70 @@ func (rs RecordSet) MarshalJSON() ([]byte, error) { if rs.Etag != nil { objectMap["etag"] = rs.Etag } - if rs.Properties != nil { - objectMap["properties"] = rs.Properties + if rs.RecordSetProperties != nil { + objectMap["properties"] = rs.RecordSetProperties } - if rs.Tags != nil { - objectMap["tags"] = rs.Tags + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for RecordSet struct. +func (rs *RecordSet) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err } - if rs.Location != nil { - objectMap["location"] = rs.Location + for k, v := range m { + switch k { + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + rs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + rs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + rs.Type = &typeVar + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + rs.Etag = &etag + } + case "properties": + if v != nil { + var recordSetProperties RecordSetProperties + err = json.Unmarshal(*v, &recordSetProperties) + if err != nil { + return err + } + rs.RecordSetProperties = &recordSetProperties + } + } } - return json.Marshal(objectMap) + + return nil } // RecordSetListResult the response to a RecordSet List operation. @@ -291,6 +359,8 @@ func NewRecordSetListResultPage(cur RecordSetListResult, getNextPage func(contex type RecordSetProperties struct { // TTL - Gets or sets the TTL of the records in the RecordSet. TTL *int64 `json:"TTL,omitempty"` + // Fqdn - READ-ONLY; Fully qualified domain name of the record set. + Fqdn *string `json:"fqdn,omitempty"` // ARecords - Gets or sets the list of A records in the RecordSet. ARecords *[]ARecord `json:"ARecords,omitempty"` // AAAARecords - Gets or sets the list of AAAA records in the RecordSet. @@ -311,6 +381,42 @@ type RecordSetProperties struct { SOARecord *SoaRecord `json:"SOARecord,omitempty"` } +// MarshalJSON is the custom marshaler for RecordSetProperties. +func (rsp RecordSetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rsp.TTL != nil { + objectMap["TTL"] = rsp.TTL + } + if rsp.ARecords != nil { + objectMap["ARecords"] = rsp.ARecords + } + if rsp.AAAARecords != nil { + objectMap["AAAARecords"] = rsp.AAAARecords + } + if rsp.MXRecords != nil { + objectMap["MXRecords"] = rsp.MXRecords + } + if rsp.NSRecords != nil { + objectMap["NSRecords"] = rsp.NSRecords + } + if rsp.PTRRecords != nil { + objectMap["PTRRecords"] = rsp.PTRRecords + } + if rsp.SRVRecords != nil { + objectMap["SRVRecords"] = rsp.SRVRecords + } + if rsp.TXTRecords != nil { + objectMap["TXTRecords"] = rsp.TXTRecords + } + if rsp.CNAMERecord != nil { + objectMap["CNAMERecord"] = rsp.CNAMERecord + } + if rsp.SOARecord != nil { + objectMap["SOARecord"] = rsp.SOARecord + } + return json.Marshal(objectMap) +} + // Resource common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -596,6 +702,20 @@ func NewZoneListResultPage(cur ZoneListResult, getNextPage func(context.Context, type ZoneProperties struct { // MaxNumberOfRecordSets - Gets or sets the maximum number of record sets that can be created in this zone. MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` + // MaxNumberOfRecordsPerRecordSet - READ-ONLY; The maximum number of records per record set that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + MaxNumberOfRecordsPerRecordSet *int64 `json:"maxNumberOfRecordsPerRecordSet,omitempty"` // NumberOfRecordSets - Gets or sets the current number of record sets in this zone. NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` } + +// MarshalJSON is the custom marshaler for ZoneProperties. +func (zp ZoneProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if zp.MaxNumberOfRecordSets != nil { + objectMap["maxNumberOfRecordSets"] = zp.MaxNumberOfRecordSets + } + if zp.NumberOfRecordSets != nil { + objectMap["numberOfRecordSets"] = zp.NumberOfRecordSets + } + return json.Marshal(objectMap) +} diff --git a/services/preview/dns/mgmt/2015-05-04-preview/dns/recordsets.go b/services/preview/dns/mgmt/2015-05-04-preview/dns/recordsets.go index b842dbcc4970..c16c547b0999 100644 --- a/services/preview/dns/mgmt/2015-05-04-preview/dns/recordsets.go +++ b/services/preview/dns/mgmt/2015-05-04-preview/dns/recordsets.go @@ -55,8 +55,7 @@ func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroup 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("dns.RecordSetsClient", "CreateOrUpdate", err.Error()) @@ -99,6 +98,9 @@ func (client RecordSetsClient) CreateOrUpdatePreparer(ctx context.Context, resou "api-version": APIVersion, } + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -128,7 +130,7 @@ func (client RecordSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Re func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (result RecordSet, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} @@ -157,8 +159,7 @@ func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Delete", err.Error()) @@ -224,7 +225,7 @@ func (client RecordSetsClient) DeleteSender(req *http.Request) (*http.Response, func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), autorest.ByClosing()) result.Response = resp return @@ -250,8 +251,7 @@ func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string 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("dns.RecordSetsClient", "Get", err.Error()) @@ -341,8 +341,7 @@ func (client RecordSetsClient) List(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("dns.RecordSetsClient", "List", err.Error()) @@ -478,8 +477,7 @@ func (client RecordSetsClient) ListAll(ctx context.Context, resourceGroupName st 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("dns.RecordSetsClient", "ListAll", err.Error()) diff --git a/services/preview/dns/mgmt/2015-05-04-preview/dns/zones.go b/services/preview/dns/mgmt/2015-05-04-preview/dns/zones.go index fccac49f5c6a..cec842bd9f8f 100644 --- a/services/preview/dns/mgmt/2015-05-04-preview/dns/zones.go +++ b/services/preview/dns/mgmt/2015-05-04-preview/dns/zones.go @@ -53,8 +53,7 @@ func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName 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("dns.ZonesClient", "CreateOrUpdate", err.Error()) @@ -151,8 +150,7 @@ func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, 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("dns.ZonesClient", "Delete", err.Error()) @@ -240,8 +238,7 @@ func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zon 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("dns.ZonesClient", "Get", err.Error()) @@ -327,8 +324,7 @@ func (client ZonesClient) ListZonesInResourceGroup(ctx context.Context, resource 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("dns.ZonesClient", "ListZonesInResourceGroup", err.Error()) diff --git a/services/preview/dns/mgmt/2018-03-01-preview/dns/CHANGELOG.md b/services/preview/dns/mgmt/2018-03-01-preview/dns/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/dns/mgmt/2018-03-01-preview/dns/CHANGELOG.md +++ b/services/preview/dns/mgmt/2018-03-01-preview/dns/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/dns/mgmt/2018-03-01-preview/dns/_meta.json b/services/preview/dns/mgmt/2018-03-01-preview/dns/_meta.json index 0469e5253267..6775b3da7491 100644 --- a/services/preview/dns/mgmt/2018-03-01-preview/dns/_meta.json +++ b/services/preview/dns/mgmt/2018-03-01-preview/dns/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/dns/resource-manager/readme.md", "tag": "package-2018-03-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/dns/mgmt/2018-03-01-preview/dns/recordsets.go b/services/preview/dns/mgmt/2018-03-01-preview/dns/recordsets.go index 28c61593011c..ef026f469841 100644 --- a/services/preview/dns/mgmt/2018-03-01-preview/dns/recordsets.go +++ b/services/preview/dns/mgmt/2018-03-01-preview/dns/recordsets.go @@ -57,8 +57,7 @@ func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroup 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("dns.RecordSetsClient", "CreateOrUpdate", err.Error()) @@ -163,8 +162,7 @@ func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Delete", err.Error()) @@ -256,8 +254,7 @@ func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string 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("dns.RecordSetsClient", "Get", err.Error()) @@ -348,8 +345,7 @@ func (client RecordSetsClient) ListAllByDNSZone(ctx context.Context, resourceGro 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("dns.RecordSetsClient", "ListAllByDNSZone", err.Error()) @@ -486,8 +482,7 @@ func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupN 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("dns.RecordSetsClient", "ListByDNSZone", err.Error()) @@ -625,8 +620,7 @@ func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName 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("dns.RecordSetsClient", "ListByType", err.Error()) @@ -765,8 +759,7 @@ func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName str 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("dns.RecordSetsClient", "Update", err.Error()) diff --git a/services/preview/dns/mgmt/2018-03-01-preview/dns/zones.go b/services/preview/dns/mgmt/2018-03-01-preview/dns/zones.go index 068bda56c554..d95eab7c94b8 100644 --- a/services/preview/dns/mgmt/2018-03-01-preview/dns/zones.go +++ b/services/preview/dns/mgmt/2018-03-01-preview/dns/zones.go @@ -54,8 +54,7 @@ func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName 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("dns.ZonesClient", "CreateOrUpdate", err.Error()) @@ -153,8 +152,7 @@ func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, 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("dns.ZonesClient", "Delete", err.Error()) @@ -245,8 +243,7 @@ func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zon 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("dns.ZonesClient", "Get", err.Error()) @@ -455,8 +452,7 @@ func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroup 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("dns.ZonesClient", "ListByResourceGroup", err.Error()) @@ -588,8 +584,7 @@ func (client ZonesClient) Update(ctx context.Context, resourceGroupName string, 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("dns.ZonesClient", "Update", err.Error()) diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json index 454ed4df5d49..11aa7a76cdcf 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2019-11-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go index 67ffe199a4a8..1b9075c20555 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/client.go @@ -1,7 +1,7 @@ // Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version // 2019-11-01-preview. // -// Use these APIs to create Source Control Configuration resources through ARM, for Kubernetes Clusters. +// KubernetesConfiguration Client package kubernetesconfiguration // Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go index 2717fc694f27..e28168692d6b 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/operations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// OperationsClient is the use these APIs to create Source Control Configuration resources through ARM, for Kubernetes -// Clusters. +// OperationsClient is the kubernetesConfiguration Client type OperationsClient struct { BaseClient } diff --git a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go index 13377cf1fac7..6d2a58188aab 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go +++ b/services/preview/kubernetesconfiguration/mgmt/2019-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -14,8 +14,7 @@ import ( "net/http" ) -// SourceControlConfigurationsClient is the use these APIs to create Source Control Configuration resources through -// ARM, for Kubernetes Clusters. +// SourceControlConfigurationsClient is the kubernetesConfiguration Client type SourceControlConfigurationsClient struct { BaseClient } diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md +++ b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json index f21af5121c6a..1d17ef073b64 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json +++ b/services/preview/kubernetesconfiguration/mgmt/2020-07-01-preview/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "d9506558e6389e62926ae385f1d625a1376a0f9d", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-2020-07-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..895843a503c3 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2020-10", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2020-10 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..bf42eecdfec8 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2020-10-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..1e9816106447 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,94 @@ +package kubernetesconfiguration + +// 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. + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // Error ... + Error MessageLevelType = "Error" + // Information ... + Information MessageLevelType = "Information" + // Warning ... + Warning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{Error, Information, Warning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..93496fe42c29 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,31 @@ +package kubernetesconfigurationapi + +// 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/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration" +) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..b2d341120b58 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,701 @@ +package kubernetesconfiguration + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration" + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'Error', 'Warning', 'Information' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// ErrorDefinition error definition. +type ErrorDefinition struct { + // Code - Service specific error code which serves as the substatus for the HTTP error code. + Code *string `json:"code,omitempty"` + // Message - Description of the error. + Message *string `json:"message,omitempty"` +} + +// ErrorResponse error response. +type ErrorResponse struct { + // Error - Error definition. + Error *ErrorDefinition `json:"error,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// ProxyResource ARM proxy resource. +type ProxyResource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pr.SystemData != nil { + objectMap["systemData"] = pr.SystemData + } + return json.Marshal(objectMap) +} + +// Resource the Resource model definition. +type Resource struct { + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.SystemData != nil { + objectMap["systemData"] = r.SystemData + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rpol) + if err != nil { + return err + } + page.rpol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Result sample result definition +type Result struct { + // SampleProperty - Sample property of type string + SampleProperty *string `json:"sampleProperty,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) 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 sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sccl) + if err != nil { + return err + } + page.sccl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SystemData top level metadata +// https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources +type SystemData struct { + // CreatedBy - READ-ONLY; A string identifier for the identity that created the resource + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - READ-ONLY; The type of identity that created the resource: user, application, managedIdentity, key + CreatedByType *string `json:"createdByType,omitempty"` + // CreatedAt - READ-ONLY; The timestamp of resource creation (UTC) + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - READ-ONLY; A string identifier for the identity that last modified the resource + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - READ-ONLY; The type of identity that last modified the resource: user, application, managedIdentity, key + LastModifiedByType *string `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - READ-ONLY; The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// MarshalJSON is the custom marshaler for SystemData. +func (sd SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..92db3fd0b55f --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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/tracing" + "net/http" +) + +// OperationsClient is the kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..11793064b890 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,414 @@ +package kubernetesconfiguration + +// 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/tracing" + "net/http" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) 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 gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-10-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..82b0cc263f5e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2020-10-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " kubernetesconfiguration/2020-10-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..47c79d0d833f --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2021-05", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-05 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..6483862b143a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2021-05-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..9fdb1420d397 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterType - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterType string, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.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("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterType, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterType string, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterRp": autorest.Encode("path", clusterRp), + "clusterType": autorest.Encode("path", clusterType), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..20f92d95dd7a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,163 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..a7f301dd30ec --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,200 @@ +package kubernetesconfiguration + +// 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. + +// ClusterTypes enumerates the values for cluster types. +type ClusterTypes string + +const ( + // ConnectedClusters ... + ConnectedClusters ClusterTypes = "connectedClusters" + // ManagedClusters ... + ManagedClusters ClusterTypes = "managedClusters" +) + +// PossibleClusterTypesValues returns an array of possible values for the ClusterTypes const type. +func PossibleClusterTypesValues() []ClusterTypes { + return []ClusterTypes{ConnectedClusters, ManagedClusters} +} + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..b7edcf88c039 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,456 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.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("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..17c239da27ae --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.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("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionTypeVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..052cdb848bea --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,82 @@ +package kubernetesconfigurationapi + +// 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/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration" +) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterType string, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..5727934ca363 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LocationExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..c11f4c730ac6 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2035 @@ +package kubernetesconfiguration + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,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 AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // ClusterScopeSettingsProperties - Extension scope settings + *ClusterScopeSettingsProperties `json:"properties,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 ClusterScopeSettings. +func (CSS ClusterScopeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ClusterScopeSettingsProperties != nil { + objectMap["properties"] = CSS.ClusterScopeSettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterScopeSettings struct. +func (CSS *ClusterScopeSettings) 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 clusterScopeSettingsProperties ClusterScopeSettingsProperties + err = json.Unmarshal(*v, &clusterScopeSettingsProperties) + if err != nil { + return err + } + CSS.ClusterScopeSettingsProperties = &clusterScopeSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + CSS.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + CSS.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + CSS.Type = &typeVar + } + } + } + + return nil +} + +// ClusterScopeSettingsProperties extension scope settings +type ClusterScopeSettingsProperties struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) 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 extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionsListIterator) Response() ExtensionsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.el) + if err != nil { + return err + } + page.el = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) 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 extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionTypeListIterator) Response() ExtensionTypeList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.etl) + if err != nil { + return err + } + page.etl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types. Possible values include: 'ConnectedClusters', 'ManagedClusters' + ClusterTypes ClusterTypes `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Versions - Versions available for this Extension Type + Versions *[]ExtensionVersionListVersionsItem `json:"versions,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Versions != nil { + objectMap["versions"] = evl.Versions + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListVersionsItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionVersionListIterator) Response() ExtensionVersionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionVersionListIterator) Value() ExtensionVersionListVersionsItem { + if !iter.page.NotDone() { + return ExtensionVersionListVersionsItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Versions == nil || len(*evl.Versions) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListVersionsItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.evl) + if err != nil { + return err + } + page.evl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListVersionsItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Versions +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListVersionsItem ... +type ExtensionVersionListVersionsItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationStatusListIterator) Response() OperationStatusList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.osl) + if err != nil { + return err + } + page.osl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// 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"` + // 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 ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource 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"` + // 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet 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"` + // 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // Origin - The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX + Origin *string `json:"origin,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + if rpo.Origin != nil { + objectMap["origin"] = rpo.Origin + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rpol) + if err != nil { + return err + } + page.rpol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) 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 sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sccl) + if err != nil { + return err + } + page.sccl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,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 TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..e79b50bd5491 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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/tracing" + "net/http" +) + +// OperationsClient is the kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..de57f7009936 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.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("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationStatusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..9fd3cd07d368 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) 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 gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.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("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-05-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..7d381549193a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-05-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " kubernetesconfiguration/2021-05-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..30be6eb099a6 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2021-11", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2021-11 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..592bb0bf891d --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2021-11-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..6d8ce1e9fbff --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.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("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..cf1e19d26bab --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,166 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..798e61694f5c --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,266 @@ +package kubernetesconfiguration + +// 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. + +// ClusterTypes enumerates the values for cluster types. +type ClusterTypes string + +const ( + // ConnectedClusters ... + ConnectedClusters ClusterTypes = "connectedClusters" + // ManagedClusters ... + ManagedClusters ClusterTypes = "managedClusters" +) + +// PossibleClusterTypesValues returns an array of possible values for the ClusterTypes const type. +func PossibleClusterTypesValues() []ClusterTypes { + return []ClusterTypes{ConnectedClusters, ManagedClusters} +} + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// FluxComplianceState enumerates the values for flux compliance state. +type FluxComplianceState string + +const ( + // FluxComplianceStateCompliant ... + FluxComplianceStateCompliant FluxComplianceState = "Compliant" + // FluxComplianceStateNonCompliant ... + FluxComplianceStateNonCompliant FluxComplianceState = "Non-Compliant" + // FluxComplianceStatePending ... + FluxComplianceStatePending FluxComplianceState = "Pending" + // FluxComplianceStateSuspended ... + FluxComplianceStateSuspended FluxComplianceState = "Suspended" + // FluxComplianceStateUnknown ... + FluxComplianceStateUnknown FluxComplianceState = "Unknown" +) + +// PossibleFluxComplianceStateValues returns an array of possible values for the FluxComplianceState const type. +func PossibleFluxComplianceStateValues() []FluxComplianceState { + return []FluxComplianceState{FluxComplianceStateCompliant, FluxComplianceStateNonCompliant, FluxComplianceStatePending, FluxComplianceStateSuspended, FluxComplianceStateUnknown} +} + +// KustomizationValidationType enumerates the values for kustomization validation type. +type KustomizationValidationType string + +const ( + // Client ... + Client KustomizationValidationType = "client" + // None ... + None KustomizationValidationType = "none" + // Server ... + Server KustomizationValidationType = "server" +) + +// PossibleKustomizationValidationTypeValues returns an array of possible values for the KustomizationValidationType const type. +func PossibleKustomizationValidationTypeValues() []KustomizationValidationType { + return []KustomizationValidationType{Client, None, Server} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// ScopeType enumerates the values for scope type. +type ScopeType string + +const ( + // ScopeTypeCluster ... + ScopeTypeCluster ScopeType = "cluster" + // ScopeTypeNamespace ... + ScopeTypeNamespace ScopeType = "namespace" +) + +// PossibleScopeTypeValues returns an array of possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ScopeTypeCluster, ScopeTypeNamespace} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceKindType enumerates the values for source kind type. +type SourceKindType string + +const ( + // GitRepository ... + GitRepository SourceKindType = "GitRepository" +) + +// PossibleSourceKindTypeValues returns an array of possible values for the SourceKindType const type. +func PossibleSourceKindTypeValues() []SourceKindType { + return []SourceKindType{GitRepository} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..2513b1b57b5d --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,555 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.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("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} + +// Update patch an existing Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// patchExtension - properties to Patch in an existing Extension. +func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, patchExtension PatchExtension) (result ExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, patchExtension PatchExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(patchExtension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) UpdateSender(req *http.Request) (future ExtensionsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) UpdateResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..f454b284d3ad --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.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("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionTypeVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go new file mode 100644 index 000000000000..483878a0a02e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go @@ -0,0 +1,128 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigOperationStatusClient is the kubernetesConfiguration Client +type FluxConfigOperationStatusClient struct { + BaseClient +} + +// NewFluxConfigOperationStatusClient creates an instance of the FluxConfigOperationStatusClient client. +func NewFluxConfigOperationStatusClient(subscriptionID string) FluxConfigOperationStatusClient { + return NewFluxConfigOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigOperationStatusClientWithBaseURI creates an instance of the FluxConfigOperationStatusClient 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 NewFluxConfigOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigOperationStatusClient { + return FluxConfigOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// operationID - operation Id +func (client FluxConfigOperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigOperationStatusClient.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("kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigOperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}", 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 FluxConfigOperationStatusClient) 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 FluxConfigOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, 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/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigurations.go new file mode 100644 index 000000000000..c0714efcac6f --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/fluxconfigurations.go @@ -0,0 +1,557 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigurationsClient is the kubernetesConfiguration Client +type FluxConfigurationsClient struct { + BaseClient +} + +// NewFluxConfigurationsClient creates an instance of the FluxConfigurationsClient client. +func NewFluxConfigurationsClient(subscriptionID string) FluxConfigurationsClient { + return NewFluxConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigurationsClientWithBaseURI creates an instance of the FluxConfigurationsClient 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 NewFluxConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigurationsClient { + return FluxConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfiguration - properties necessary to Create a FluxConfiguration. +func (client FluxConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (result FluxConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FluxConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfiguration), + 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 FluxConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future FluxConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result FluxConfiguration, 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 this will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the +// source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client FluxConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, forceDelete *bool) (result FluxConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FluxConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) DeleteSender(req *http.Request) (future FluxConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +func (client FluxConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string) (result FluxConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.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("kubernetesconfiguration.FluxConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) GetResponder(resp *http.Response) (result FluxConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Flux Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client FluxConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result FluxConfigurationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.fcl.Response.Response != nil { + sc = result.fcl.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("kubernetesconfiguration.FluxConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.fcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.fcl.hasNextLink() && result.fcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FluxConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FluxConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) ListResponder(resp *http.Response) (result FluxConfigurationsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client FluxConfigurationsClient) listNextResults(ctx context.Context, lastResults FluxConfigurationsList) (result FluxConfigurationsList, err error) { + req, err := lastResults.fluxConfigurationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FluxConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result FluxConfigurationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} + +// Update update an existing Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfigurationPatch - properties to Patch in an existing Flux Configuration. +func (client FluxConfigurationsClient) Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (result FluxConfigurationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfigurationPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FluxConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfigurationPatch), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FluxConfigurationsClient) UpdateSender(req *http.Request) (future FluxConfigurationsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) UpdateResponder(resp *http.Response) (result FluxConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..c68405c3c5f8 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,102 @@ +package kubernetesconfigurationapi + +// 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/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration" +) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, patchExtension kubernetesconfiguration.PatchExtension) (result kubernetesconfiguration.ExtensionsUpdateFuture, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// FluxConfigurationsClientAPI contains the set of methods on the FluxConfigurationsClient type. +type FluxConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfiguration kubernetesconfiguration.FluxConfiguration) (result kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, forceDelete *bool) (result kubernetesconfiguration.FluxConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string) (result kubernetesconfiguration.FluxConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, fluxConfigurationPatch kubernetesconfiguration.FluxConfigurationPatch) (result kubernetesconfiguration.FluxConfigurationsUpdateFuture, err error) +} + +var _ FluxConfigurationsClientAPI = (*kubernetesconfiguration.FluxConfigurationsClient)(nil) + +// FluxConfigOperationStatusClientAPI contains the set of methods on the FluxConfigOperationStatusClient type. +type FluxConfigOperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, fluxConfigurationName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) +} + +var _ FluxConfigOperationStatusClientAPI = (*kubernetesconfiguration.FluxConfigOperationStatusClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..701a106d44b7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LocationExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..5d59412c2a05 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2797 @@ +package kubernetesconfiguration + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,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 AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // ClusterScopeSettingsProperties - Extension scope settings + *ClusterScopeSettingsProperties `json:"properties,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 ClusterScopeSettings. +func (CSS ClusterScopeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ClusterScopeSettingsProperties != nil { + objectMap["properties"] = CSS.ClusterScopeSettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterScopeSettings struct. +func (CSS *ClusterScopeSettings) 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 clusterScopeSettingsProperties ClusterScopeSettingsProperties + err = json.Unmarshal(*v, &clusterScopeSettingsProperties) + if err != nil { + return err + } + CSS.ClusterScopeSettingsProperties = &clusterScopeSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + CSS.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + CSS.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + CSS.Type = &typeVar + } + } + } + + return nil +} + +// ClusterScopeSettingsProperties extension scope settings +type ClusterScopeSettingsProperties struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// DependsOnDefinition specify which kustomizations must succeed reconciliation on the cluster prior to +// reconciling this kustomization +type DependsOnDefinition struct { + // KustomizationName - Name of the kustomization to claim dependency on + KustomizationName *string `json:"kustomizationName,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) 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 extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` + // AksAssignedIdentity - Identity of the Extension resource in an AKS cluster + AksAssignedIdentity *ExtensionPropertiesAksAssignedIdentity `json:"aksAssignedIdentity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + if e.AksAssignedIdentity != nil { + objectMap["aksAssignedIdentity"] = e.AksAssignedIdentity + } + return json.Marshal(objectMap) +} + +// ExtensionPropertiesAksAssignedIdentity identity of the Extension resource in an AKS cluster +type ExtensionPropertiesAksAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionPropertiesAksAssignedIdentity. +func (eAi ExtensionPropertiesAksAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eAi.Type != "" { + objectMap["type"] = eAi.Type + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionsListIterator) Response() ExtensionsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.el) + if err != nil { + return err + } + page.el = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsUpdateFuture.Result. +func (future *ExtensionsUpdateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) 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 extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionTypeListIterator) Response() ExtensionTypeList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.etl) + if err != nil { + return err + } + page.etl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types. Possible values include: 'ConnectedClusters', 'ManagedClusters' + ClusterTypes ClusterTypes `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Versions - Versions available for this Extension Type + Versions *[]ExtensionVersionListVersionsItem `json:"versions,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Versions != nil { + objectMap["versions"] = evl.Versions + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListVersionsItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionVersionListIterator) Response() ExtensionVersionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionVersionListIterator) Value() ExtensionVersionListVersionsItem { + if !iter.page.NotDone() { + return ExtensionVersionListVersionsItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Versions == nil || len(*evl.Versions) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListVersionsItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.evl) + if err != nil { + return err + } + page.evl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListVersionsItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Versions +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListVersionsItem ... +type ExtensionVersionListVersionsItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// FluxConfiguration the Flux Configuration object returned in Get & Put response. +type FluxConfiguration struct { + autorest.Response `json:"-"` + // FluxConfigurationProperties - Properties to create a Flux Configuration resource + *FluxConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 FluxConfiguration. +func (fc FluxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.FluxConfigurationProperties != nil { + objectMap["properties"] = fc.FluxConfigurationProperties + } + if fc.SystemData != nil { + objectMap["systemData"] = fc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfiguration struct. +func (fc *FluxConfiguration) 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 fluxConfigurationProperties FluxConfigurationProperties + err = json.Unmarshal(*v, &fluxConfigurationProperties) + if err != nil { + return err + } + fc.FluxConfigurationProperties = &fluxConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fc.Type = &typeVar + } + } + } + + return nil +} + +// FluxConfigurationPatch the Flux Configuration Patch Request object. +type FluxConfigurationPatch struct { + // FluxConfigurationPatchProperties - Updatable properties of an Flux Configuration Patch Request + *FluxConfigurationPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatch. +func (fcp FluxConfigurationPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.FluxConfigurationPatchProperties != nil { + objectMap["properties"] = fcp.FluxConfigurationPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfigurationPatch struct. +func (fcp *FluxConfigurationPatch) 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 fluxConfigurationPatchProperties FluxConfigurationPatchProperties + err = json.Unmarshal(*v, &fluxConfigurationPatchProperties) + if err != nil { + return err + } + fcp.FluxConfigurationPatchProperties = &fluxConfigurationPatchProperties + } + } + } + + return nil +} + +// FluxConfigurationPatchProperties updatable properties of an Flux Configuration Patch Request +type FluxConfigurationPatchProperties struct { + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatchProperties. +func (fcp FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.SourceKind != "" { + objectMap["sourceKind"] = fcp.SourceKind + } + if fcp.Suspend != nil { + objectMap["suspend"] = fcp.Suspend + } + if fcp.GitRepository != nil { + objectMap["gitRepository"] = fcp.GitRepository + } + if fcp.Kustomizations != nil { + objectMap["kustomizations"] = fcp.Kustomizations + } + if fcp.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fcp.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationProperties properties to create a Flux Configuration resource +type FluxConfigurationProperties struct { + // Scope - Scope at which the operator will be installed. Possible values include: 'ScopeTypeCluster', 'ScopeTypeNamespace' + Scope ScopeType `json:"scope,omitempty"` + // Namespace - The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + Namespace *string `json:"namespace,omitempty"` + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // Statuses - READ-ONLY; Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. + Statuses *[]ObjectStatusDefinition `json:"statuses,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this fluxConfiguration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // LastSourceSyncedCommitID - READ-ONLY; Branch and SHA of the last source commit synced with the cluster. + LastSourceSyncedCommitID *string `json:"lastSourceSyncedCommitId,omitempty"` + // LastSourceSyncedAt - READ-ONLY; Datetime the fluxConfiguration last synced its source on the cluster. + LastSourceSyncedAt *date.Time `json:"lastSourceSyncedAt,omitempty"` + // ComplianceState - READ-ONLY; Combined status of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // ProvisioningState - READ-ONLY; Status of the creation of the fluxConfiguration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ErrorMessage - READ-ONLY; Error message returned to the user in the case of provisioning failure. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationProperties. +func (fc FluxConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.Scope != "" { + objectMap["scope"] = fc.Scope + } + if fc.Namespace != nil { + objectMap["namespace"] = fc.Namespace + } + if fc.SourceKind != "" { + objectMap["sourceKind"] = fc.SourceKind + } + if fc.Suspend != nil { + objectMap["suspend"] = fc.Suspend + } + if fc.GitRepository != nil { + objectMap["gitRepository"] = fc.GitRepository + } + if fc.Kustomizations != nil { + objectMap["kustomizations"] = fc.Kustomizations + } + if fc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fc.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsCreateOrUpdateFuture.Result. +func (future *FluxConfigurationsCreateOrUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.CreateOrUpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// FluxConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsDeleteFuture.Result. +func (future *FluxConfigurationsDeleteFuture) result(client FluxConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FluxConfigurationsList result of the request to list Flux Configurations. It contains a list of +// FluxConfiguration objects and a URL link to get the next set of results. +type FluxConfigurationsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Flux Configurations within a Kubernetes cluster. + Value *[]FluxConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationsList. +func (fcl FluxConfigurationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FluxConfigurationsListIterator provides access to a complete listing of FluxConfiguration values. +type FluxConfigurationsListIterator struct { + i int + page FluxConfigurationsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FluxConfigurationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FluxConfigurationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FluxConfigurationsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FluxConfigurationsListIterator) Response() FluxConfigurationsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FluxConfigurationsListIterator) Value() FluxConfiguration { + if !iter.page.NotDone() { + return FluxConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FluxConfigurationsListIterator type. +func NewFluxConfigurationsListIterator(page FluxConfigurationsListPage) FluxConfigurationsListIterator { + return FluxConfigurationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fcl FluxConfigurationsList) IsEmpty() bool { + return fcl.Value == nil || len(*fcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fcl FluxConfigurationsList) hasNextLink() bool { + return fcl.NextLink != nil && len(*fcl.NextLink) != 0 +} + +// fluxConfigurationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fcl FluxConfigurationsList) fluxConfigurationsListPreparer(ctx context.Context) (*http.Request, error) { + if !fcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fcl.NextLink))) +} + +// FluxConfigurationsListPage contains a page of FluxConfiguration values. +type FluxConfigurationsListPage struct { + fn func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error) + fcl FluxConfigurationsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FluxConfigurationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fcl) + if err != nil { + return err + } + page.fcl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FluxConfigurationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FluxConfigurationsListPage) NotDone() bool { + return !page.fcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FluxConfigurationsListPage) Response() FluxConfigurationsList { + return page.fcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FluxConfigurationsListPage) Values() []FluxConfiguration { + if page.fcl.IsEmpty() { + return nil + } + return *page.fcl.Value +} + +// Creates a new instance of the FluxConfigurationsListPage type. +func NewFluxConfigurationsListPage(cur FluxConfigurationsList, getNextPage func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error)) FluxConfigurationsListPage { + return FluxConfigurationsListPage{ + fn: getNextPage, + fcl: cur, + } +} + +// FluxConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsUpdateFuture.Result. +func (future *FluxConfigurationsUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.UpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// GitRepositoryDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Base64-encoded HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCAFile - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCAFile *string `json:"httpsCAFile,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// HelmReleasePropertiesDefinition ... +type HelmReleasePropertiesDefinition struct { + // LastRevisionApplied - The revision number of the last released object change + LastRevisionApplied *int64 `json:"lastRevisionApplied,omitempty"` + // HelmChartRef - The reference to the HelmChart object used as the source to this HelmRelease + HelmChartRef *ObjectReferenceDefinition `json:"helmChartRef,omitempty"` + // FailureCount - Total number of times that the HelmRelease failed to install or upgrade + FailureCount *int64 `json:"failureCount,omitempty"` + // InstallFailureCount - Number of times that the HelmRelease failed to install + InstallFailureCount *int64 `json:"installFailureCount,omitempty"` + // UpgradeFailureCount - Number of times that the HelmRelease failed to upgrade + UpgradeFailureCount *int64 `json:"upgradeFailureCount,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// KustomizationDefinition the Kustomization defining how to reconcile the artifact pulled by the source +// type on the cluster. +type KustomizationDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Validation - Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. Possible values include: 'None', 'Client', 'Server' + Validation KustomizationValidationType `json:"validation,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// ObjectReferenceDefinition object reference to a Kubernetes object on a cluster +type ObjectReferenceDefinition struct { + // Name - Name of the object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the object + Namespace *string `json:"namespace,omitempty"` +} + +// ObjectStatusConditionDefinition status condition of Kubernetes object +type ObjectStatusConditionDefinition struct { + // LastTransitionTime - Last time this status condition has changed + LastTransitionTime *date.Time `json:"lastTransitionTime,omitempty"` + // Message - A more verbose description of the object status condition + Message *string `json:"message,omitempty"` + // Reason - Reason for the specified status condition type status + Reason *string `json:"reason,omitempty"` + // Status - Status of the Kubernetes object condition type + Status *string `json:"status,omitempty"` + // Type - Object status condition type for this object + Type *string `json:"type,omitempty"` +} + +// ObjectStatusDefinition statuses of objects deployed by the user-specified kustomizations from the git +// repository. +type ObjectStatusDefinition struct { + // Name - Name of the applied object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the applied object + Namespace *string `json:"namespace,omitempty"` + // Kind - Kind of the applied object + Kind *string `json:"kind,omitempty"` + // ComplianceState - Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // AppliedBy - Object reference to the Kustomization that applied this object + AppliedBy *ObjectReferenceDefinition `json:"appliedBy,omitempty"` + // StatusConditions - List of Kubernetes object status conditions present on the cluster + StatusConditions *[]ObjectStatusConditionDefinition `json:"statusConditions,omitempty"` + // HelmReleaseProperties - Additional properties that are provided from objects of the HelmRelease kind + HelmReleaseProperties *HelmReleasePropertiesDefinition `json:"helmReleaseProperties,omitempty"` +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationStatusListIterator) Response() OperationStatusList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.osl) + if err != nil { + return err + } + page.osl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// PatchExtension the Extension Patch Request object. +type PatchExtension struct { + // PatchExtensionProperties - Updatable properties of an Extension Patch Request + *PatchExtensionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchExtension. +func (peVar PatchExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PatchExtensionProperties != nil { + objectMap["properties"] = peVar.PatchExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchExtension struct. +func (peVar *PatchExtension) 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 patchExtensionProperties PatchExtensionProperties + err = json.Unmarshal(*v, &patchExtensionProperties) + if err != nil { + return err + } + peVar.PatchExtensionProperties = &patchExtensionProperties + } + } + } + + return nil +} + +// PatchExtensionProperties updatable properties of an Extension Patch Request +type PatchExtensionProperties struct { + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for PatchExtensionProperties. +func (peVar PatchExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = peVar.AutoUpgradeMinorVersion + } + if peVar.ReleaseTrain != nil { + objectMap["releaseTrain"] = peVar.ReleaseTrain + } + if peVar.Version != nil { + objectMap["version"] = peVar.Version + } + if peVar.ConfigurationSettings != nil { + objectMap["configurationSettings"] = peVar.ConfigurationSettings + } + if peVar.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = peVar.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// 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"` + // 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 ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RepositoryRefDefinition the source reference for the GitRepository object. +type RepositoryRefDefinition struct { + // Branch - The git repository branch name to checkout. + Branch *string `json:"branch,omitempty"` + // Tag - The git repository tag name to checkout. This takes precedence over branch. + Tag *string `json:"tag,omitempty"` + // Semver - The semver range used to match against git repository tags. This takes precedence over tag. + Semver *string `json:"semver,omitempty"` + // Commit - The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. + Commit *string `json:"commit,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource 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"` + // 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet 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"` + // 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Origin - READ-ONLY; Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rpol) + if err != nil { + return err + } + page.rpol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) 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 sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sccl) + if err != nil { + return err + } + page.sccl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,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 TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..b62242a9ff6c --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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/tracing" + "net/http" +) + +// OperationsClient is the kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..ab307f579a8e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.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("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationStatusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..26a28c09c540 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) 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 gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.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("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp string, clusterResourceName string, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..cd52ce9db8a0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2021-11-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " kubernetesconfiguration/2021-11-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..0deb39142f01 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2022-01", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..ad4f75523b32 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/client.go @@ -0,0 +1,42 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version +// 2022-01-01-preview. +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..6b294911dcac --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.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("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..776de805a6b7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,166 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..f1ba81413eb6 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,298 @@ +package kubernetesconfiguration + +// 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. + +// ClusterTypes enumerates the values for cluster types. +type ClusterTypes string + +const ( + // ConnectedClusters ... + ConnectedClusters ClusterTypes = "connectedClusters" + // ManagedClusters ... + ManagedClusters ClusterTypes = "managedClusters" +) + +// PossibleClusterTypesValues returns an array of possible values for the ClusterTypes const type. +func PossibleClusterTypesValues() []ClusterTypes { + return []ClusterTypes{ConnectedClusters, ManagedClusters} +} + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// ExtensionsClusterResourceName enumerates the values for extensions cluster resource name. +type ExtensionsClusterResourceName string + +const ( + // ExtensionsClusterResourceNameConnectedClusters ... + ExtensionsClusterResourceNameConnectedClusters ExtensionsClusterResourceName = "connectedClusters" + // ExtensionsClusterResourceNameManagedClusters ... + ExtensionsClusterResourceNameManagedClusters ExtensionsClusterResourceName = "managedClusters" +) + +// PossibleExtensionsClusterResourceNameValues returns an array of possible values for the ExtensionsClusterResourceName const type. +func PossibleExtensionsClusterResourceNameValues() []ExtensionsClusterResourceName { + return []ExtensionsClusterResourceName{ExtensionsClusterResourceNameConnectedClusters, ExtensionsClusterResourceNameManagedClusters} +} + +// ExtensionsClusterRp enumerates the values for extensions cluster rp. +type ExtensionsClusterRp string + +const ( + // MicrosoftContainerService ... + MicrosoftContainerService ExtensionsClusterRp = "Microsoft.ContainerService" + // MicrosoftKubernetes ... + MicrosoftKubernetes ExtensionsClusterRp = "Microsoft.Kubernetes" +) + +// PossibleExtensionsClusterRpValues returns an array of possible values for the ExtensionsClusterRp const type. +func PossibleExtensionsClusterRpValues() []ExtensionsClusterRp { + return []ExtensionsClusterRp{MicrosoftContainerService, MicrosoftKubernetes} +} + +// FluxComplianceState enumerates the values for flux compliance state. +type FluxComplianceState string + +const ( + // FluxComplianceStateCompliant ... + FluxComplianceStateCompliant FluxComplianceState = "Compliant" + // FluxComplianceStateNonCompliant ... + FluxComplianceStateNonCompliant FluxComplianceState = "Non-Compliant" + // FluxComplianceStatePending ... + FluxComplianceStatePending FluxComplianceState = "Pending" + // FluxComplianceStateSuspended ... + FluxComplianceStateSuspended FluxComplianceState = "Suspended" + // FluxComplianceStateUnknown ... + FluxComplianceStateUnknown FluxComplianceState = "Unknown" +) + +// PossibleFluxComplianceStateValues returns an array of possible values for the FluxComplianceState const type. +func PossibleFluxComplianceStateValues() []FluxComplianceState { + return []FluxComplianceState{FluxComplianceStateCompliant, FluxComplianceStateNonCompliant, FluxComplianceStatePending, FluxComplianceStateSuspended, FluxComplianceStateUnknown} +} + +// KustomizationValidationType enumerates the values for kustomization validation type. +type KustomizationValidationType string + +const ( + // Client ... + Client KustomizationValidationType = "client" + // None ... + None KustomizationValidationType = "none" + // Server ... + Server KustomizationValidationType = "server" +) + +// PossibleKustomizationValidationTypeValues returns an array of possible values for the KustomizationValidationType const type. +func PossibleKustomizationValidationTypeValues() []KustomizationValidationType { + return []KustomizationValidationType{Client, None, Server} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// ScopeType enumerates the values for scope type. +type ScopeType string + +const ( + // ScopeTypeCluster ... + ScopeTypeCluster ScopeType = "cluster" + // ScopeTypeNamespace ... + ScopeTypeNamespace ScopeType = "namespace" +) + +// PossibleScopeTypeValues returns an array of possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ScopeTypeCluster, ScopeTypeNamespace} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceKindType enumerates the values for source kind type. +type SourceKindType string + +const ( + // Bucket ... + Bucket SourceKindType = "Bucket" + // GitRepository ... + GitRepository SourceKindType = "GitRepository" +) + +// PossibleSourceKindTypeValues returns an array of possible values for the SourceKindType const type. +func PossibleSourceKindTypeValues() []SourceKindType { + return []SourceKindType{Bucket, GitRepository} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..58d8447bcc65 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,555 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.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("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} + +// Update patch an existing Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// patchExtension - properties to Patch in an existing Extension. +func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (result ExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(patchExtension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) UpdateSender(req *http.Request) (future ExtensionsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) UpdateResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..1d727485f9fd --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.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("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionTypeVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go new file mode 100644 index 000000000000..a4229db101c7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigoperationstatus.go @@ -0,0 +1,128 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigOperationStatusClient is the kubernetesConfiguration Client +type FluxConfigOperationStatusClient struct { + BaseClient +} + +// NewFluxConfigOperationStatusClient creates an instance of the FluxConfigOperationStatusClient client. +func NewFluxConfigOperationStatusClient(subscriptionID string) FluxConfigOperationStatusClient { + return NewFluxConfigOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigOperationStatusClientWithBaseURI creates an instance of the FluxConfigOperationStatusClient 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 NewFluxConfigOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigOperationStatusClient { + return FluxConfigOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// operationID - operation Id +func (client FluxConfigOperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigOperationStatusClient.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("kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigOperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}", 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 FluxConfigOperationStatusClient) 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 FluxConfigOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, 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/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigurations.go new file mode 100644 index 000000000000..220ed8904bc7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/fluxconfigurations.go @@ -0,0 +1,557 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigurationsClient is the kubernetesConfiguration Client +type FluxConfigurationsClient struct { + BaseClient +} + +// NewFluxConfigurationsClient creates an instance of the FluxConfigurationsClient client. +func NewFluxConfigurationsClient(subscriptionID string) FluxConfigurationsClient { + return NewFluxConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigurationsClientWithBaseURI creates an instance of the FluxConfigurationsClient 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 NewFluxConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigurationsClient { + return FluxConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfiguration - properties necessary to Create a FluxConfiguration. +func (client FluxConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (result FluxConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FluxConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfiguration), + 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 FluxConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future FluxConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result FluxConfiguration, 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 this will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the +// source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client FluxConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result FluxConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FluxConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) DeleteSender(req *http.Request) (future FluxConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +func (client FluxConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result FluxConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.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("kubernetesconfiguration.FluxConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) GetResponder(resp *http.Response) (result FluxConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Flux Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client FluxConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.fcl.Response.Response != nil { + sc = result.fcl.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("kubernetesconfiguration.FluxConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.fcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.fcl.hasNextLink() && result.fcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FluxConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FluxConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) ListResponder(resp *http.Response) (result FluxConfigurationsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client FluxConfigurationsClient) listNextResults(ctx context.Context, lastResults FluxConfigurationsList) (result FluxConfigurationsList, err error) { + req, err := lastResults.fluxConfigurationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FluxConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} + +// Update update an existing Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfigurationPatch - properties to Patch in an existing Flux Configuration. +func (client FluxConfigurationsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (result FluxConfigurationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfigurationPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FluxConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfigurationPatch), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FluxConfigurationsClient) UpdateSender(req *http.Request) (future FluxConfigurationsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) UpdateResponder(resp *http.Response) (result FluxConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..d1f650a961a7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,102 @@ +package kubernetesconfigurationapi + +// 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/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration" +) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension kubernetesconfiguration.PatchExtension) (result kubernetesconfiguration.ExtensionsUpdateFuture, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// FluxConfigurationsClientAPI contains the set of methods on the FluxConfigurationsClient type. +type FluxConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration kubernetesconfiguration.FluxConfiguration) (result kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result kubernetesconfiguration.FluxConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result kubernetesconfiguration.FluxConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch kubernetesconfiguration.FluxConfigurationPatch) (result kubernetesconfiguration.FluxConfigurationsUpdateFuture, err error) +} + +var _ FluxConfigurationsClientAPI = (*kubernetesconfiguration.FluxConfigurationsClient)(nil) + +// FluxConfigOperationStatusClientAPI contains the set of methods on the FluxConfigOperationStatusClient type. +type FluxConfigOperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) +} + +var _ FluxConfigOperationStatusClientAPI = (*kubernetesconfiguration.FluxConfigOperationStatusClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..d8f4a8e9b76e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LocationExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..acc2bf32ee4a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2880 @@ +package kubernetesconfiguration + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,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 AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BucketDefinition parameters to reconcile to the GitRepository source kind type. +type BucketDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// BucketPatchDefinition parameters to reconcile to the GitRepository source kind type. +type BucketPatchDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // ClusterScopeSettingsProperties - Extension scope settings + *ClusterScopeSettingsProperties `json:"properties,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 ClusterScopeSettings. +func (CSS ClusterScopeSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if CSS.ClusterScopeSettingsProperties != nil { + objectMap["properties"] = CSS.ClusterScopeSettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ClusterScopeSettings struct. +func (CSS *ClusterScopeSettings) 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 clusterScopeSettingsProperties ClusterScopeSettingsProperties + err = json.Unmarshal(*v, &clusterScopeSettingsProperties) + if err != nil { + return err + } + CSS.ClusterScopeSettingsProperties = &clusterScopeSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + CSS.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + CSS.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + CSS.Type = &typeVar + } + } + } + + return nil +} + +// ClusterScopeSettingsProperties extension scope settings +type ClusterScopeSettingsProperties struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// DependsOnDefinition specify which kustomizations must succeed reconciliation on the cluster prior to +// reconciling this kustomization +type DependsOnDefinition struct { + // KustomizationName - Name of the kustomization to claim dependency on + KustomizationName *string `json:"kustomizationName,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) 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 extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` + // AksAssignedIdentity - Identity of the Extension resource in an AKS cluster + AksAssignedIdentity *ExtensionPropertiesAksAssignedIdentity `json:"aksAssignedIdentity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + if e.AksAssignedIdentity != nil { + objectMap["aksAssignedIdentity"] = e.AksAssignedIdentity + } + return json.Marshal(objectMap) +} + +// ExtensionPropertiesAksAssignedIdentity identity of the Extension resource in an AKS cluster +type ExtensionPropertiesAksAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionPropertiesAksAssignedIdentity. +func (eAi ExtensionPropertiesAksAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eAi.Type != "" { + objectMap["type"] = eAi.Type + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionsListIterator) Response() ExtensionsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.el) + if err != nil { + return err + } + page.el = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsUpdateFuture.Result. +func (future *ExtensionsUpdateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) 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 extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionTypeListIterator) Response() ExtensionTypeList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.etl) + if err != nil { + return err + } + page.etl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types. Possible values include: 'ConnectedClusters', 'ManagedClusters' + ClusterTypes ClusterTypes `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Versions - Versions available for this Extension Type + Versions *[]ExtensionVersionListVersionsItem `json:"versions,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Versions != nil { + objectMap["versions"] = evl.Versions + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListVersionsItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionVersionListIterator) Response() ExtensionVersionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionVersionListIterator) Value() ExtensionVersionListVersionsItem { + if !iter.page.NotDone() { + return ExtensionVersionListVersionsItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Versions == nil || len(*evl.Versions) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListVersionsItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.evl) + if err != nil { + return err + } + page.evl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListVersionsItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Versions +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListVersionsItem ... +type ExtensionVersionListVersionsItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// FluxConfiguration the Flux Configuration object returned in Get & Put response. +type FluxConfiguration struct { + autorest.Response `json:"-"` + // FluxConfigurationProperties - Properties to create a Flux Configuration resource + *FluxConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 FluxConfiguration. +func (fc FluxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.FluxConfigurationProperties != nil { + objectMap["properties"] = fc.FluxConfigurationProperties + } + if fc.SystemData != nil { + objectMap["systemData"] = fc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfiguration struct. +func (fc *FluxConfiguration) 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 fluxConfigurationProperties FluxConfigurationProperties + err = json.Unmarshal(*v, &fluxConfigurationProperties) + if err != nil { + return err + } + fc.FluxConfigurationProperties = &fluxConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fc.Type = &typeVar + } + } + } + + return nil +} + +// FluxConfigurationPatch the Flux Configuration Patch Request object. +type FluxConfigurationPatch struct { + // FluxConfigurationPatchProperties - Updatable properties of an Flux Configuration Patch Request + *FluxConfigurationPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatch. +func (fcp FluxConfigurationPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.FluxConfigurationPatchProperties != nil { + objectMap["properties"] = fcp.FluxConfigurationPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfigurationPatch struct. +func (fcp *FluxConfigurationPatch) 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 fluxConfigurationPatchProperties FluxConfigurationPatchProperties + err = json.Unmarshal(*v, &fluxConfigurationPatchProperties) + if err != nil { + return err + } + fcp.FluxConfigurationPatchProperties = &fluxConfigurationPatchProperties + } + } + } + + return nil +} + +// FluxConfigurationPatchProperties updatable properties of an Flux Configuration Patch Request +type FluxConfigurationPatchProperties struct { + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryPatchDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationPatchDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatchProperties. +func (fcp FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.SourceKind != "" { + objectMap["sourceKind"] = fcp.SourceKind + } + if fcp.Suspend != nil { + objectMap["suspend"] = fcp.Suspend + } + if fcp.GitRepository != nil { + objectMap["gitRepository"] = fcp.GitRepository + } + if fcp.Bucket != nil { + objectMap["bucket"] = fcp.Bucket + } + if fcp.Kustomizations != nil { + objectMap["kustomizations"] = fcp.Kustomizations + } + if fcp.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fcp.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationProperties properties to create a Flux Configuration resource +type FluxConfigurationProperties struct { + // Scope - Scope at which the operator will be installed. Possible values include: 'ScopeTypeCluster', 'ScopeTypeNamespace' + Scope ScopeType `json:"scope,omitempty"` + // Namespace - The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + Namespace *string `json:"namespace,omitempty"` + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // Statuses - READ-ONLY; Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. + Statuses *[]ObjectStatusDefinition `json:"statuses,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this fluxConfiguration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // LastSourceUpdatedCommitID - READ-ONLY; Branch and SHA of the last source commit synced with the cluster. + LastSourceUpdatedCommitID *string `json:"lastSourceUpdatedCommitId,omitempty"` + // LastSourceUpdatedAt - READ-ONLY; Datetime the fluxConfiguration last synced its source on the cluster. + LastSourceUpdatedAt *date.Time `json:"lastSourceUpdatedAt,omitempty"` + // ComplianceState - READ-ONLY; Combined status of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // ProvisioningState - READ-ONLY; Status of the creation of the fluxConfiguration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ErrorMessage - READ-ONLY; Error message returned to the user in the case of provisioning failure. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationProperties. +func (fc FluxConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.Scope != "" { + objectMap["scope"] = fc.Scope + } + if fc.Namespace != nil { + objectMap["namespace"] = fc.Namespace + } + if fc.SourceKind != "" { + objectMap["sourceKind"] = fc.SourceKind + } + if fc.Suspend != nil { + objectMap["suspend"] = fc.Suspend + } + if fc.GitRepository != nil { + objectMap["gitRepository"] = fc.GitRepository + } + if fc.Bucket != nil { + objectMap["bucket"] = fc.Bucket + } + if fc.Kustomizations != nil { + objectMap["kustomizations"] = fc.Kustomizations + } + if fc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fc.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsCreateOrUpdateFuture.Result. +func (future *FluxConfigurationsCreateOrUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.CreateOrUpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// FluxConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsDeleteFuture.Result. +func (future *FluxConfigurationsDeleteFuture) result(client FluxConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FluxConfigurationsList result of the request to list Flux Configurations. It contains a list of +// FluxConfiguration objects and a URL link to get the next set of results. +type FluxConfigurationsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Flux Configurations within a Kubernetes cluster. + Value *[]FluxConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationsList. +func (fcl FluxConfigurationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FluxConfigurationsListIterator provides access to a complete listing of FluxConfiguration values. +type FluxConfigurationsListIterator struct { + i int + page FluxConfigurationsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FluxConfigurationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FluxConfigurationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FluxConfigurationsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FluxConfigurationsListIterator) Response() FluxConfigurationsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FluxConfigurationsListIterator) Value() FluxConfiguration { + if !iter.page.NotDone() { + return FluxConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FluxConfigurationsListIterator type. +func NewFluxConfigurationsListIterator(page FluxConfigurationsListPage) FluxConfigurationsListIterator { + return FluxConfigurationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fcl FluxConfigurationsList) IsEmpty() bool { + return fcl.Value == nil || len(*fcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fcl FluxConfigurationsList) hasNextLink() bool { + return fcl.NextLink != nil && len(*fcl.NextLink) != 0 +} + +// fluxConfigurationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fcl FluxConfigurationsList) fluxConfigurationsListPreparer(ctx context.Context) (*http.Request, error) { + if !fcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fcl.NextLink))) +} + +// FluxConfigurationsListPage contains a page of FluxConfiguration values. +type FluxConfigurationsListPage struct { + fn func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error) + fcl FluxConfigurationsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FluxConfigurationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fcl) + if err != nil { + return err + } + page.fcl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FluxConfigurationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FluxConfigurationsListPage) NotDone() bool { + return !page.fcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FluxConfigurationsListPage) Response() FluxConfigurationsList { + return page.fcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FluxConfigurationsListPage) Values() []FluxConfiguration { + if page.fcl.IsEmpty() { + return nil + } + return *page.fcl.Value +} + +// Creates a new instance of the FluxConfigurationsListPage type. +func NewFluxConfigurationsListPage(cur FluxConfigurationsList, getNextPage func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error)) FluxConfigurationsListPage { + return FluxConfigurationsListPage{ + fn: getNextPage, + fcl: cur, + } +} + +// FluxConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsUpdateFuture.Result. +func (future *FluxConfigurationsUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.UpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// GitRepositoryDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// GitRepositoryPatchDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryPatchDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// HelmReleasePropertiesDefinition ... +type HelmReleasePropertiesDefinition struct { + // LastRevisionApplied - The revision number of the last released object change + LastRevisionApplied *int64 `json:"lastRevisionApplied,omitempty"` + // HelmChartRef - The reference to the HelmChart object used as the source to this HelmRelease + HelmChartRef *ObjectReferenceDefinition `json:"helmChartRef,omitempty"` + // FailureCount - Total number of times that the HelmRelease failed to install or upgrade + FailureCount *int64 `json:"failureCount,omitempty"` + // InstallFailureCount - Number of times that the HelmRelease failed to install + InstallFailureCount *int64 `json:"installFailureCount,omitempty"` + // UpgradeFailureCount - Number of times that the HelmRelease failed to upgrade + UpgradeFailureCount *int64 `json:"upgradeFailureCount,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// KustomizationDefinition the Kustomization defining how to reconcile the artifact pulled by the source +// type on the cluster. +type KustomizationDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// KustomizationPatchDefinition the Kustomization defining how to reconcile the artifact pulled by the +// source type on the cluster. +type KustomizationPatchDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// ObjectReferenceDefinition object reference to a Kubernetes object on a cluster +type ObjectReferenceDefinition struct { + // Name - Name of the object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the object + Namespace *string `json:"namespace,omitempty"` +} + +// ObjectStatusConditionDefinition status condition of Kubernetes object +type ObjectStatusConditionDefinition struct { + // LastTransitionTime - Last time this status condition has changed + LastTransitionTime *date.Time `json:"lastTransitionTime,omitempty"` + // Message - A more verbose description of the object status condition + Message *string `json:"message,omitempty"` + // Reason - Reason for the specified status condition type status + Reason *string `json:"reason,omitempty"` + // Status - Status of the Kubernetes object condition type + Status *string `json:"status,omitempty"` + // Type - Object status condition type for this object + Type *string `json:"type,omitempty"` +} + +// ObjectStatusDefinition statuses of objects deployed by the user-specified kustomizations from the git +// repository. +type ObjectStatusDefinition struct { + // Name - Name of the applied object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the applied object + Namespace *string `json:"namespace,omitempty"` + // Kind - Kind of the applied object + Kind *string `json:"kind,omitempty"` + // ComplianceState - Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // AppliedBy - Object reference to the Kustomization that applied this object + AppliedBy *ObjectReferenceDefinition `json:"appliedBy,omitempty"` + // StatusConditions - List of Kubernetes object status conditions present on the cluster + StatusConditions *[]ObjectStatusConditionDefinition `json:"statusConditions,omitempty"` + // HelmReleaseProperties - Additional properties that are provided from objects of the HelmRelease kind + HelmReleaseProperties *HelmReleasePropertiesDefinition `json:"helmReleaseProperties,omitempty"` +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationStatusListIterator) Response() OperationStatusList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.osl) + if err != nil { + return err + } + page.osl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// PatchExtension the Extension Patch Request object. +type PatchExtension struct { + // PatchExtensionProperties - Updatable properties of an Extension Patch Request + *PatchExtensionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchExtension. +func (peVar PatchExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PatchExtensionProperties != nil { + objectMap["properties"] = peVar.PatchExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchExtension struct. +func (peVar *PatchExtension) 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 patchExtensionProperties PatchExtensionProperties + err = json.Unmarshal(*v, &patchExtensionProperties) + if err != nil { + return err + } + peVar.PatchExtensionProperties = &patchExtensionProperties + } + } + } + + return nil +} + +// PatchExtensionProperties updatable properties of an Extension Patch Request +type PatchExtensionProperties struct { + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for PatchExtensionProperties. +func (peVar PatchExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = peVar.AutoUpgradeMinorVersion + } + if peVar.ReleaseTrain != nil { + objectMap["releaseTrain"] = peVar.ReleaseTrain + } + if peVar.Version != nil { + objectMap["version"] = peVar.Version + } + if peVar.ConfigurationSettings != nil { + objectMap["configurationSettings"] = peVar.ConfigurationSettings + } + if peVar.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = peVar.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// 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"` + // 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 ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RepositoryRefDefinition the source reference for the GitRepository object. +type RepositoryRefDefinition struct { + // Branch - The git repository branch name to checkout. + Branch *string `json:"branch,omitempty"` + // Tag - The git repository tag name to checkout. This takes precedence over branch. + Tag *string `json:"tag,omitempty"` + // Semver - The semver range used to match against git repository tags. This takes precedence over tag. + Semver *string `json:"semver,omitempty"` + // Commit - The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. + Commit *string `json:"commit,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource 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"` + // 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet 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"` + // 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Origin - READ-ONLY; Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rpol) + if err != nil { + return err + } + page.rpol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) 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 sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sccl) + if err != nil { + return err + } + page.sccl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,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 TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..b08a45c050b4 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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/tracing" + "net/http" +) + +// OperationsClient is the kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..0a88f703e9e9 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.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("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationStatusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..bf36d87ae8b2 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) 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 gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.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("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..2ccd3aede340 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-01-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " kubernetesconfiguration/2022-01-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/_meta.json new file mode 100644 index 000000000000..955893348818 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", + "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "tag": "package-preview-2022-01-15", + "use": "@microsoft.azure/autorest.go@2.1.187", + "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", + "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-preview-2022-01-15 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/client.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/client.go new file mode 100644 index 000000000000..937988ca0f57 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/client.go @@ -0,0 +1,41 @@ +// Package kubernetesconfiguration implements the Azure ARM Kubernetesconfiguration service API version . +// +// KubernetesConfiguration Client +package kubernetesconfiguration + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Kubernetesconfiguration + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Kubernetesconfiguration. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient 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 NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontype.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontype.go new file mode 100644 index 000000000000..d6d113a13780 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontype.go @@ -0,0 +1,126 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypeClient is the kubernetesConfiguration Client +type ClusterExtensionTypeClient struct { + BaseClient +} + +// NewClusterExtensionTypeClient creates an instance of the ClusterExtensionTypeClient client. +func NewClusterExtensionTypeClient(subscriptionID string) ClusterExtensionTypeClient { + return NewClusterExtensionTypeClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypeClientWithBaseURI creates an instance of the ClusterExtensionTypeClient 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 NewClusterExtensionTypeClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypeClient { + return ClusterExtensionTypeClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Extension Type details +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionTypeName - extension type name +func (client ClusterExtensionTypeClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result ExtensionType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypeClient.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("kubernetesconfiguration.ClusterExtensionTypeClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypeClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ClusterExtensionTypeClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}", 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 ClusterExtensionTypeClient) 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 ClusterExtensionTypeClient) GetResponder(resp *http.Response) (result ExtensionType, 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontypes.go new file mode 100644 index 000000000000..bcb896b94c8c --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/clusterextensiontypes.go @@ -0,0 +1,166 @@ +package kubernetesconfiguration + +// 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" +) + +// ClusterExtensionTypesClient is the kubernetesConfiguration Client +type ClusterExtensionTypesClient struct { + BaseClient +} + +// NewClusterExtensionTypesClient creates an instance of the ClusterExtensionTypesClient client. +func NewClusterExtensionTypesClient(subscriptionID string) ClusterExtensionTypesClient { + return NewClusterExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewClusterExtensionTypesClientWithBaseURI creates an instance of the ClusterExtensionTypesClient 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 NewClusterExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) ClusterExtensionTypesClient { + return ClusterExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get Extension Types +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ClusterExtensionTypesClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.ClusterExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ClusterExtensionTypesClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ClusterExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ClusterExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ClusterExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ClusterExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ClusterExtensionTypesClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ClusterExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/enums.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/enums.go new file mode 100644 index 000000000000..35ae447ae4d5 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/enums.go @@ -0,0 +1,283 @@ +package kubernetesconfiguration + +// 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. + +// ComplianceStateType enumerates the values for compliance state type. +type ComplianceStateType string + +const ( + // Compliant ... + Compliant ComplianceStateType = "Compliant" + // Failed ... + Failed ComplianceStateType = "Failed" + // Installed ... + Installed ComplianceStateType = "Installed" + // Noncompliant ... + Noncompliant ComplianceStateType = "Noncompliant" + // Pending ... + Pending ComplianceStateType = "Pending" +) + +// PossibleComplianceStateTypeValues returns an array of possible values for the ComplianceStateType const type. +func PossibleComplianceStateTypeValues() []ComplianceStateType { + return []ComplianceStateType{Compliant, Failed, Installed, Noncompliant, Pending} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// ExtensionsClusterResourceName enumerates the values for extensions cluster resource name. +type ExtensionsClusterResourceName string + +const ( + // ConnectedClusters ... + ConnectedClusters ExtensionsClusterResourceName = "connectedClusters" + // ManagedClusters ... + ManagedClusters ExtensionsClusterResourceName = "managedClusters" +) + +// PossibleExtensionsClusterResourceNameValues returns an array of possible values for the ExtensionsClusterResourceName const type. +func PossibleExtensionsClusterResourceNameValues() []ExtensionsClusterResourceName { + return []ExtensionsClusterResourceName{ConnectedClusters, ManagedClusters} +} + +// ExtensionsClusterRp enumerates the values for extensions cluster rp. +type ExtensionsClusterRp string + +const ( + // MicrosoftContainerService ... + MicrosoftContainerService ExtensionsClusterRp = "Microsoft.ContainerService" + // MicrosoftKubernetes ... + MicrosoftKubernetes ExtensionsClusterRp = "Microsoft.Kubernetes" +) + +// PossibleExtensionsClusterRpValues returns an array of possible values for the ExtensionsClusterRp const type. +func PossibleExtensionsClusterRpValues() []ExtensionsClusterRp { + return []ExtensionsClusterRp{MicrosoftContainerService, MicrosoftKubernetes} +} + +// FluxComplianceState enumerates the values for flux compliance state. +type FluxComplianceState string + +const ( + // FluxComplianceStateCompliant ... + FluxComplianceStateCompliant FluxComplianceState = "Compliant" + // FluxComplianceStateNonCompliant ... + FluxComplianceStateNonCompliant FluxComplianceState = "Non-Compliant" + // FluxComplianceStatePending ... + FluxComplianceStatePending FluxComplianceState = "Pending" + // FluxComplianceStateSuspended ... + FluxComplianceStateSuspended FluxComplianceState = "Suspended" + // FluxComplianceStateUnknown ... + FluxComplianceStateUnknown FluxComplianceState = "Unknown" +) + +// PossibleFluxComplianceStateValues returns an array of possible values for the FluxComplianceState const type. +func PossibleFluxComplianceStateValues() []FluxComplianceState { + return []FluxComplianceState{FluxComplianceStateCompliant, FluxComplianceStateNonCompliant, FluxComplianceStatePending, FluxComplianceStateSuspended, FluxComplianceStateUnknown} +} + +// KustomizationValidationType enumerates the values for kustomization validation type. +type KustomizationValidationType string + +const ( + // Client ... + Client KustomizationValidationType = "client" + // None ... + None KustomizationValidationType = "none" + // Server ... + Server KustomizationValidationType = "server" +) + +// PossibleKustomizationValidationTypeValues returns an array of possible values for the KustomizationValidationType const type. +func PossibleKustomizationValidationTypeValues() []KustomizationValidationType { + return []KustomizationValidationType{Client, None, Server} +} + +// LevelType enumerates the values for level type. +type LevelType string + +const ( + // Error ... + Error LevelType = "Error" + // Information ... + Information LevelType = "Information" + // Warning ... + Warning LevelType = "Warning" +) + +// PossibleLevelTypeValues returns an array of possible values for the LevelType const type. +func PossibleLevelTypeValues() []LevelType { + return []LevelType{Error, Information, Warning} +} + +// MessageLevelType enumerates the values for message level type. +type MessageLevelType string + +const ( + // MessageLevelTypeError ... + MessageLevelTypeError MessageLevelType = "Error" + // MessageLevelTypeInformation ... + MessageLevelTypeInformation MessageLevelType = "Information" + // MessageLevelTypeWarning ... + MessageLevelTypeWarning MessageLevelType = "Warning" +) + +// PossibleMessageLevelTypeValues returns an array of possible values for the MessageLevelType const type. +func PossibleMessageLevelTypeValues() []MessageLevelType { + return []MessageLevelType{MessageLevelTypeError, MessageLevelTypeInformation, MessageLevelTypeWarning} +} + +// OperatorScopeType enumerates the values for operator scope type. +type OperatorScopeType string + +const ( + // Cluster ... + Cluster OperatorScopeType = "cluster" + // Namespace ... + Namespace OperatorScopeType = "namespace" +) + +// PossibleOperatorScopeTypeValues returns an array of possible values for the OperatorScopeType const type. +func PossibleOperatorScopeTypeValues() []OperatorScopeType { + return []OperatorScopeType{Cluster, Namespace} +} + +// OperatorType enumerates the values for operator type. +type OperatorType string + +const ( + // Flux ... + Flux OperatorType = "Flux" +) + +// PossibleOperatorTypeValues returns an array of possible values for the OperatorType const type. +func PossibleOperatorTypeValues() []OperatorType { + return []OperatorType{Flux} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled ... + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating ... + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting ... + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed ... + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded ... + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating ... + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreating, ProvisioningStateDeleting, ProvisioningStateFailed, ProvisioningStateSucceeded, ProvisioningStateUpdating} +} + +// ProvisioningStateType enumerates the values for provisioning state type. +type ProvisioningStateType string + +const ( + // ProvisioningStateTypeAccepted ... + ProvisioningStateTypeAccepted ProvisioningStateType = "Accepted" + // ProvisioningStateTypeDeleting ... + ProvisioningStateTypeDeleting ProvisioningStateType = "Deleting" + // ProvisioningStateTypeFailed ... + ProvisioningStateTypeFailed ProvisioningStateType = "Failed" + // ProvisioningStateTypeRunning ... + ProvisioningStateTypeRunning ProvisioningStateType = "Running" + // ProvisioningStateTypeSucceeded ... + ProvisioningStateTypeSucceeded ProvisioningStateType = "Succeeded" +) + +// PossibleProvisioningStateTypeValues returns an array of possible values for the ProvisioningStateType const type. +func PossibleProvisioningStateTypeValues() []ProvisioningStateType { + return []ProvisioningStateType{ProvisioningStateTypeAccepted, ProvisioningStateTypeDeleting, ProvisioningStateTypeFailed, ProvisioningStateTypeRunning, ProvisioningStateTypeSucceeded} +} + +// ResourceIdentityType enumerates the values for resource identity type. +type ResourceIdentityType string + +const ( + // SystemAssigned ... + SystemAssigned ResourceIdentityType = "SystemAssigned" +) + +// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type. +func PossibleResourceIdentityTypeValues() []ResourceIdentityType { + return []ResourceIdentityType{SystemAssigned} +} + +// ScopeType enumerates the values for scope type. +type ScopeType string + +const ( + // ScopeTypeCluster ... + ScopeTypeCluster ScopeType = "cluster" + // ScopeTypeNamespace ... + ScopeTypeNamespace ScopeType = "namespace" +) + +// PossibleScopeTypeValues returns an array of possible values for the ScopeType const type. +func PossibleScopeTypeValues() []ScopeType { + return []ScopeType{ScopeTypeCluster, ScopeTypeNamespace} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Basic ... + Basic SkuTier = "Basic" + // Free ... + Free SkuTier = "Free" + // Premium ... + Premium SkuTier = "Premium" + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Basic, Free, Premium, Standard} +} + +// SourceKindType enumerates the values for source kind type. +type SourceKindType string + +const ( + // Bucket ... + Bucket SourceKindType = "Bucket" + // GitRepository ... + GitRepository SourceKindType = "GitRepository" +) + +// PossibleSourceKindTypeValues returns an array of possible values for the SourceKindType const type. +func PossibleSourceKindTypeValues() []SourceKindType { + return []SourceKindType{Bucket, GitRepository} +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensions.go new file mode 100644 index 000000000000..58d8447bcc65 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensions.go @@ -0,0 +1,555 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionsClient is the kubernetesConfiguration Client +type ExtensionsClient struct { + BaseClient +} + +// NewExtensionsClient creates an instance of the ExtensionsClient client. +func NewExtensionsClient(subscriptionID string) ExtensionsClient { + return NewExtensionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionsClientWithBaseURI creates an instance of the ExtensionsClient 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 NewExtensionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionsClient { + return ExtensionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Create create a new Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// extension - properties necessary to Create an Extension. +func (client ExtensionsClient) Create(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (result ExtensionsCreateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Create") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Create", err.Error()) + } + + req, err := client.CreatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = client.CreateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Create", result.Response(), "Failure sending request") + return + } + + return +} + +// CreatePreparer prepares the Create request. +func (client ExtensionsClient) CreatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, extension Extension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(extension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateSender sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) CreateSender(req *http.Request) (future ExtensionsCreateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResponder handles the response to the Create request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) CreateResponder(resp *http.Response) (result Extension, 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 Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client ExtensionsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result ExtensionsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ExtensionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) DeleteSender(req *http.Request) (future ExtensionsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +func (client ExtensionsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (result Extension, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.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("kubernetesconfiguration.ExtensionsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ExtensionsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", 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 ExtensionsClient) 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 ExtensionsClient) GetResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Extensions in the cluster. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client ExtensionsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.el.Response.Response != nil { + sc = result.el.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("kubernetesconfiguration.ExtensionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.el.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure sending request") + return + } + + result.el, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "List", resp, "Failure responding to request") + return + } + if result.el.hasNextLink() && result.el.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) ListResponder(resp *http.Response) (result ExtensionsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionsClient) listNextResults(ctx context.Context, lastResults ExtensionsList) (result ExtensionsList, err error) { + req, err := lastResults.extensionsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result ExtensionsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} + +// Update patch an existing Kubernetes Cluster Extension. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// patchExtension - properties to Patch in an existing Extension. +func (client ExtensionsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (result ExtensionsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.ExtensionsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client ExtensionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension PatchExtension) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}", pathParameters), + autorest.WithJSON(patchExtension), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionsClient) UpdateSender(req *http.Request) (future ExtensionsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client ExtensionsClient) UpdateResponder(resp *http.Response) (result Extension, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensiontypeversions.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensiontypeversions.go new file mode 100644 index 000000000000..8707df9f18bb --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/extensiontypeversions.go @@ -0,0 +1,157 @@ +package kubernetesconfiguration + +// 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" +) + +// ExtensionTypeVersionsClient is the kubernetesConfiguration Client +type ExtensionTypeVersionsClient struct { + BaseClient +} + +// NewExtensionTypeVersionsClient creates an instance of the ExtensionTypeVersionsClient client. +func NewExtensionTypeVersionsClient(subscriptionID string) ExtensionTypeVersionsClient { + return NewExtensionTypeVersionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewExtensionTypeVersionsClientWithBaseURI creates an instance of the ExtensionTypeVersionsClient 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 NewExtensionTypeVersionsClientWithBaseURI(baseURI string, subscriptionID string) ExtensionTypeVersionsClient { + return ExtensionTypeVersionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list available versions for an Extension Type +// Parameters: +// location - extension location +// extensionTypeName - extension type name +func (client ExtensionTypeVersionsClient) List(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.evl.Response.Response != nil { + sc = result.evl.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("kubernetesconfiguration.ExtensionTypeVersionsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location, extensionTypeName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.evl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure sending request") + return + } + + result.evl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "List", resp, "Failure responding to request") + return + } + if result.evl.hasNextLink() && result.evl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ExtensionTypeVersionsClient) ListPreparer(ctx context.Context, location string, extensionTypeName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "extensionTypeName": autorest.Encode("path", extensionTypeName), + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client ExtensionTypeVersionsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client ExtensionTypeVersionsClient) ListResponder(resp *http.Response) (result ExtensionVersionList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client ExtensionTypeVersionsClient) listNextResults(ctx context.Context, lastResults ExtensionVersionList) (result ExtensionVersionList, err error) { + req, err := lastResults.extensionVersionListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionTypeVersionsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ExtensionTypeVersionsClient) ListComplete(ctx context.Context, location string, extensionTypeName string) (result ExtensionVersionListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeVersionsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location, extensionTypeName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigoperationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigoperationstatus.go new file mode 100644 index 000000000000..a4229db101c7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigoperationstatus.go @@ -0,0 +1,128 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigOperationStatusClient is the kubernetesConfiguration Client +type FluxConfigOperationStatusClient struct { + BaseClient +} + +// NewFluxConfigOperationStatusClient creates an instance of the FluxConfigOperationStatusClient client. +func NewFluxConfigOperationStatusClient(subscriptionID string) FluxConfigOperationStatusClient { + return NewFluxConfigOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigOperationStatusClientWithBaseURI creates an instance of the FluxConfigOperationStatusClient 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 NewFluxConfigOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigOperationStatusClient { + return FluxConfigOperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// operationID - operation Id +func (client FluxConfigOperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigOperationStatusClient.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("kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigOperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigOperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}", 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 FluxConfigOperationStatusClient) 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 FluxConfigOperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, 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/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigurations.go new file mode 100644 index 000000000000..220ed8904bc7 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/fluxconfigurations.go @@ -0,0 +1,557 @@ +package kubernetesconfiguration + +// 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" +) + +// FluxConfigurationsClient is the kubernetesConfiguration Client +type FluxConfigurationsClient struct { + BaseClient +} + +// NewFluxConfigurationsClient creates an instance of the FluxConfigurationsClient client. +func NewFluxConfigurationsClient(subscriptionID string) FluxConfigurationsClient { + return NewFluxConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewFluxConfigurationsClientWithBaseURI creates an instance of the FluxConfigurationsClient 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 NewFluxConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) FluxConfigurationsClient { + return FluxConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfiguration - properties necessary to Create a FluxConfiguration. +func (client FluxConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (result FluxConfigurationsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client FluxConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration FluxConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfiguration), + 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 FluxConfigurationsClient) CreateOrUpdateSender(req *http.Request) (future FluxConfigurationsCreateOrUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result FluxConfiguration, 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 this will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the +// source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// forceDelete - delete the extension resource in Azure - not the normal asynchronous delete. +func (client FluxConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result FluxConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, forceDelete) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client FluxConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if forceDelete != nil { + queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) DeleteSender(req *http.Request) (future FluxConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets details of the Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +func (client FluxConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result FluxConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.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("kubernetesconfiguration.FluxConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client FluxConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", 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 FluxConfigurationsClient) 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 FluxConfigurationsClient) GetResponder(resp *http.Response) (result FluxConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Flux Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client FluxConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.fcl.Response.Response != nil { + sc = result.fcl.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("kubernetesconfiguration.FluxConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.fcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.fcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.fcl.hasNextLink() && result.fcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client FluxConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client FluxConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) ListResponder(resp *http.Response) (result FluxConfigurationsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client FluxConfigurationsClient) listNextResults(ctx context.Context, lastResults FluxConfigurationsList) (result FluxConfigurationsList, err error) { + req, err := lastResults.fluxConfigurationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client FluxConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result FluxConfigurationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} + +// Update update an existing Kubernetes Flux Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// fluxConfigurationName - name of the Flux Configuration. +// fluxConfigurationPatch - properties to Patch in an existing Flux Configuration. +func (client FluxConfigurationsClient) Update(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (result FluxConfigurationsUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsClient.Update") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.FluxConfigurationsClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, fluxConfigurationName, fluxConfigurationPatch) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client FluxConfigurationsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch FluxConfigurationPatch) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "fluxConfigurationName": autorest.Encode("path", fluxConfigurationName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}", pathParameters), + autorest.WithJSON(fluxConfigurationPatch), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client FluxConfigurationsClient) UpdateSender(req *http.Request) (future FluxConfigurationsUpdateFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client FluxConfigurationsClient) UpdateResponder(resp *http.Response) (result FluxConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go new file mode 100644 index 000000000000..2dcbabc1759e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/kubernetesconfigurationapi/interfaces.go @@ -0,0 +1,102 @@ +package kubernetesconfigurationapi + +// 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/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration" +) + +// ClusterExtensionTypeClientAPI contains the set of methods on the ClusterExtensionTypeClient type. +type ClusterExtensionTypeClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionTypeName string) (result kubernetesconfiguration.ExtensionType, err error) +} + +var _ ClusterExtensionTypeClientAPI = (*kubernetesconfiguration.ClusterExtensionTypeClient)(nil) + +// ClusterExtensionTypesClientAPI contains the set of methods on the ClusterExtensionTypesClient type. +type ClusterExtensionTypesClientAPI interface { + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ ClusterExtensionTypesClientAPI = (*kubernetesconfiguration.ClusterExtensionTypesClient)(nil) + +// ExtensionTypeVersionsClientAPI contains the set of methods on the ExtensionTypeVersionsClient type. +type ExtensionTypeVersionsClientAPI interface { + List(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListPage, err error) + ListComplete(ctx context.Context, location string, extensionTypeName string) (result kubernetesconfiguration.ExtensionVersionListIterator, err error) +} + +var _ ExtensionTypeVersionsClientAPI = (*kubernetesconfiguration.ExtensionTypeVersionsClient)(nil) + +// LocationExtensionTypesClientAPI contains the set of methods on the LocationExtensionTypesClient type. +type LocationExtensionTypesClientAPI interface { + List(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListPage, err error) + ListComplete(ctx context.Context, location string) (result kubernetesconfiguration.ExtensionTypeListIterator, err error) +} + +var _ LocationExtensionTypesClientAPI = (*kubernetesconfiguration.LocationExtensionTypesClient)(nil) + +// ExtensionsClientAPI contains the set of methods on the ExtensionsClient type. +type ExtensionsClientAPI interface { + Create(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, extension kubernetesconfiguration.Extension) (result kubernetesconfiguration.ExtensionsCreateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, forceDelete *bool) (result kubernetesconfiguration.ExtensionsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string) (result kubernetesconfiguration.Extension, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.ExtensionsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, patchExtension kubernetesconfiguration.PatchExtension) (result kubernetesconfiguration.ExtensionsUpdateFuture, err error) +} + +var _ ExtensionsClientAPI = (*kubernetesconfiguration.ExtensionsClient)(nil) + +// OperationStatusClientAPI contains the set of methods on the OperationStatusClient type. +type OperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.OperationStatusListIterator, err error) +} + +var _ OperationStatusClientAPI = (*kubernetesconfiguration.OperationStatusClient)(nil) + +// FluxConfigurationsClientAPI contains the set of methods on the FluxConfigurationsClient type. +type FluxConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfiguration kubernetesconfiguration.FluxConfiguration) (result kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, forceDelete *bool) (result kubernetesconfiguration.FluxConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string) (result kubernetesconfiguration.FluxConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.FluxConfigurationsListIterator, err error) + Update(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, fluxConfigurationPatch kubernetesconfiguration.FluxConfigurationPatch) (result kubernetesconfiguration.FluxConfigurationsUpdateFuture, err error) +} + +var _ FluxConfigurationsClientAPI = (*kubernetesconfiguration.FluxConfigurationsClient)(nil) + +// FluxConfigOperationStatusClientAPI contains the set of methods on the FluxConfigOperationStatusClient type. +type FluxConfigOperationStatusClientAPI interface { + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, fluxConfigurationName string, operationID string) (result kubernetesconfiguration.OperationStatusResult, err error) +} + +var _ FluxConfigOperationStatusClientAPI = (*kubernetesconfiguration.FluxConfigOperationStatusClient)(nil) + +// SourceControlConfigurationsClientAPI contains the set of methods on the SourceControlConfigurationsClient type. +type SourceControlConfigurationsClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration kubernetesconfiguration.SourceControlConfiguration) (result kubernetesconfiguration.SourceControlConfiguration, err error) + Delete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfigurationsDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result kubernetesconfiguration.SourceControlConfiguration, err error) + List(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListPage, err error) + ListComplete(ctx context.Context, resourceGroupName string, clusterRp kubernetesconfiguration.ExtensionsClusterRp, clusterResourceName kubernetesconfiguration.ExtensionsClusterResourceName, clusterName string) (result kubernetesconfiguration.SourceControlConfigurationListIterator, err error) +} + +var _ SourceControlConfigurationsClientAPI = (*kubernetesconfiguration.SourceControlConfigurationsClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListPage, err error) + ListComplete(ctx context.Context) (result kubernetesconfiguration.ResourceProviderOperationListIterator, err error) +} + +var _ OperationsClientAPI = (*kubernetesconfiguration.OperationsClient)(nil) diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/locationextensiontypes.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/locationextensiontypes.go new file mode 100644 index 000000000000..f791ecbfefb3 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/locationextensiontypes.go @@ -0,0 +1,155 @@ +package kubernetesconfiguration + +// 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" +) + +// LocationExtensionTypesClient is the kubernetesConfiguration Client +type LocationExtensionTypesClient struct { + BaseClient +} + +// NewLocationExtensionTypesClient creates an instance of the LocationExtensionTypesClient client. +func NewLocationExtensionTypesClient(subscriptionID string) LocationExtensionTypesClient { + return NewLocationExtensionTypesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewLocationExtensionTypesClientWithBaseURI creates an instance of the LocationExtensionTypesClient 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 NewLocationExtensionTypesClientWithBaseURI(baseURI string, subscriptionID string) LocationExtensionTypesClient { + return LocationExtensionTypesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all Extension Types +// Parameters: +// location - extension location +func (client LocationExtensionTypesClient) List(ctx context.Context, location string) (result ExtensionTypeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.etl.Response.Response != nil { + sc = result.etl.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("kubernetesconfiguration.LocationExtensionTypesClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, location) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.etl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure sending request") + return + } + + result.etl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "List", resp, "Failure responding to request") + return + } + if result.etl.hasNextLink() && result.etl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client LocationExtensionTypesClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "location": autorest.Encode("path", location), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-15-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client LocationExtensionTypesClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client LocationExtensionTypesClient) ListResponder(resp *http.Response) (result ExtensionTypeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client LocationExtensionTypesClient) listNextResults(ctx context.Context, lastResults ExtensionTypeList) (result ExtensionTypeList, err error) { + req, err := lastResults.extensionTypeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.LocationExtensionTypesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client LocationExtensionTypesClient) ListComplete(ctx context.Context, location string) (result ExtensionTypeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/LocationExtensionTypesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, location) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/models.go new file mode 100644 index 000000000000..4adfcedd4c0a --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/models.go @@ -0,0 +1,2841 @@ +package kubernetesconfiguration + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration" + +// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,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 AzureEntityResource. +func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// BucketDefinition parameters to reconcile to the GitRepository source kind type. +type BucketDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// BucketPatchDefinition parameters to reconcile to the GitRepository source kind type. +type BucketPatchDefinition struct { + // URL - The URL to sync for the flux configuration S3 bucket. + URL *string `json:"url,omitempty"` + // BucketName - The bucket name to sync from the url endpoint for the flux configuration. + BucketName *string `json:"bucketName,omitempty"` + // Insecure - Specify whether to use insecure communication when puling data from the S3 bucket. + Insecure *bool `json:"insecure,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // AccessKey - Plaintext access key used to securely access the S3 bucket + AccessKey *string `json:"accessKey,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// ClusterScopeSettings extension scope settings +type ClusterScopeSettings struct { + // AllowMultipleInstances - Describes if multiple instances of the extension are allowed + AllowMultipleInstances *bool `json:"allowMultipleInstances,omitempty"` + // DefaultReleaseNamespace - Default extension release namespace + DefaultReleaseNamespace *string `json:"defaultReleaseNamespace,omitempty"` +} + +// ComplianceStatus compliance Status details +type ComplianceStatus struct { + // ComplianceState - READ-ONLY; The compliance state of the configuration. Possible values include: 'Pending', 'Compliant', 'Noncompliant', 'Installed', 'Failed' + ComplianceState ComplianceStateType `json:"complianceState,omitempty"` + // LastConfigApplied - Datetime the configuration was last applied. + LastConfigApplied *date.Time `json:"lastConfigApplied,omitempty"` + // Message - Message from when the configuration was applied. + Message *string `json:"message,omitempty"` + // MessageLevel - Level of the message. Possible values include: 'MessageLevelTypeError', 'MessageLevelTypeWarning', 'MessageLevelTypeInformation' + MessageLevel MessageLevelType `json:"messageLevel,omitempty"` +} + +// MarshalJSON is the custom marshaler for ComplianceStatus. +func (cs ComplianceStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cs.LastConfigApplied != nil { + objectMap["lastConfigApplied"] = cs.LastConfigApplied + } + if cs.Message != nil { + objectMap["message"] = cs.Message + } + if cs.MessageLevel != "" { + objectMap["messageLevel"] = cs.MessageLevel + } + return json.Marshal(objectMap) +} + +// DependsOnDefinition specify which kustomizations must succeed reconciliation on the cluster prior to +// reconciling this kustomization +type DependsOnDefinition struct { + // KustomizationName - Name of the kustomization to claim dependency on + KustomizationName *string `json:"kustomizationName,omitempty"` +} + +// ErrorAdditionalInfo the resource management error additional info. +type ErrorAdditionalInfo struct { + // Type - READ-ONLY; The additional info type. + Type *string `json:"type,omitempty"` + // Info - READ-ONLY; The additional info. + Info interface{} `json:"info,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorAdditionalInfo. +func (eai ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorDetail the error detail. +type ErrorDetail struct { + // Code - READ-ONLY; The error code. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The error message. + Message *string `json:"message,omitempty"` + // Target - READ-ONLY; The error target. + Target *string `json:"target,omitempty"` + // Details - READ-ONLY; The error details. + Details *[]ErrorDetail `json:"details,omitempty"` + // AdditionalInfo - READ-ONLY; The error additional info. + AdditionalInfo *[]ErrorAdditionalInfo `json:"additionalInfo,omitempty"` +} + +// MarshalJSON is the custom marshaler for ErrorDetail. +func (ed ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ErrorResponse common error response for all Azure Resource Manager APIs to return error details for +// failed operations. (This also follows the OData error response format.). +type ErrorResponse struct { + // Error - The error object. + Error *ErrorDetail `json:"error,omitempty"` +} + +// Extension the Extension object. +type Extension struct { + autorest.Response `json:"-"` + // ExtensionProperties - Properties of an Extension resource + *ExtensionProperties `json:"properties,omitempty"` + // Identity - Identity of the Extension resource + Identity *Identity `json:"identity,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 Extension. +func (e Extension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionProperties != nil { + objectMap["properties"] = e.ExtensionProperties + } + if e.Identity != nil { + objectMap["identity"] = e.Identity + } + if e.SystemData != nil { + objectMap["systemData"] = e.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Extension struct. +func (e *Extension) 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 extensionProperties ExtensionProperties + err = json.Unmarshal(*v, &extensionProperties) + if err != nil { + return err + } + e.ExtensionProperties = &extensionProperties + } + case "identity": + if v != nil { + var identity Identity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + e.Identity = &identity + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + e.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + e.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + e.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + e.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionProperties properties of an Extension resource +type ExtensionProperties struct { + // ExtensionType - Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + ExtensionType *string `json:"extensionType,omitempty"` + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // Scope - Scope at which the extension is installed. + Scope *Scope `json:"scope,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // ProvisioningState - READ-ONLY; Status of installation of this extension. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // Statuses - Status from this extension. + Statuses *[]ExtensionStatus `json:"statuses,omitempty"` + // ErrorInfo - READ-ONLY; Error information from the Agent - e.g. errors during installation. + ErrorInfo *ErrorDetail `json:"errorInfo,omitempty"` + // CustomLocationSettings - READ-ONLY; Custom Location settings properties. + CustomLocationSettings map[string]*string `json:"customLocationSettings"` + // PackageURI - READ-ONLY; Uri of the Helm package + PackageURI *string `json:"packageUri,omitempty"` + // AksAssignedIdentity - Identity of the Extension resource in an AKS cluster + AksAssignedIdentity *ExtensionPropertiesAksAssignedIdentity `json:"aksAssignedIdentity,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionProperties. +func (e ExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if e.ExtensionType != nil { + objectMap["extensionType"] = e.ExtensionType + } + if e.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = e.AutoUpgradeMinorVersion + } + if e.ReleaseTrain != nil { + objectMap["releaseTrain"] = e.ReleaseTrain + } + if e.Version != nil { + objectMap["version"] = e.Version + } + if e.Scope != nil { + objectMap["scope"] = e.Scope + } + if e.ConfigurationSettings != nil { + objectMap["configurationSettings"] = e.ConfigurationSettings + } + if e.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = e.ConfigurationProtectedSettings + } + if e.Statuses != nil { + objectMap["statuses"] = e.Statuses + } + if e.AksAssignedIdentity != nil { + objectMap["aksAssignedIdentity"] = e.AksAssignedIdentity + } + return json.Marshal(objectMap) +} + +// ExtensionPropertiesAksAssignedIdentity identity of the Extension resource in an AKS cluster +type ExtensionPropertiesAksAssignedIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionPropertiesAksAssignedIdentity. +func (eAi ExtensionPropertiesAksAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eAi.Type != "" { + objectMap["type"] = eAi.Type + } + return json.Marshal(objectMap) +} + +// ExtensionsCreateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsCreateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsCreateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsCreateFuture.Result. +func (future *ExtensionsCreateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsCreateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.CreateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsCreateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsDeleteFuture.Result. +func (future *ExtensionsDeleteFuture) result(client ExtensionsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// ExtensionsList result of the request to list Extensions. It contains a list of Extension objects and a +// URL link to get the next set of results. +type ExtensionsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Extensions within a Kubernetes cluster. + Value *[]Extension `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of extension objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionsList. +func (el ExtensionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionsListIterator provides access to a complete listing of Extension values. +type ExtensionsListIterator struct { + i int + page ExtensionsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionsListIterator) Response() ExtensionsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionsListIterator) Value() Extension { + if !iter.page.NotDone() { + return Extension{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionsListIterator type. +func NewExtensionsListIterator(page ExtensionsListPage) ExtensionsListIterator { + return ExtensionsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (el ExtensionsList) IsEmpty() bool { + return el.Value == nil || len(*el.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (el ExtensionsList) hasNextLink() bool { + return el.NextLink != nil && len(*el.NextLink) != 0 +} + +// extensionsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (el ExtensionsList) extensionsListPreparer(ctx context.Context) (*http.Request, error) { + if !el.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(el.NextLink))) +} + +// ExtensionsListPage contains a page of Extension values. +type ExtensionsListPage struct { + fn func(context.Context, ExtensionsList) (ExtensionsList, error) + el ExtensionsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.el) + if err != nil { + return err + } + page.el = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionsListPage) NotDone() bool { + return !page.el.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionsListPage) Response() ExtensionsList { + return page.el +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionsListPage) Values() []Extension { + if page.el.IsEmpty() { + return nil + } + return *page.el.Value +} + +// Creates a new instance of the ExtensionsListPage type. +func NewExtensionsListPage(cur ExtensionsList, getNextPage func(context.Context, ExtensionsList) (ExtensionsList, error)) ExtensionsListPage { + return ExtensionsListPage{ + fn: getNextPage, + el: cur, + } +} + +// ExtensionStatus status from the extension. +type ExtensionStatus struct { + // Code - Status code provided by the Extension + Code *string `json:"code,omitempty"` + // DisplayStatus - Short description of status of the extension. + DisplayStatus *string `json:"displayStatus,omitempty"` + // Level - Level of the status. Possible values include: 'Error', 'Warning', 'Information' + Level LevelType `json:"level,omitempty"` + // Message - Detailed message of the status from the Extension. + Message *string `json:"message,omitempty"` + // Time - DateLiteral (per ISO8601) noting the time of installation status. + Time *string `json:"time,omitempty"` +} + +// ExtensionsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ExtensionsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ExtensionsClient) (Extension, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *ExtensionsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for ExtensionsUpdateFuture.Result. +func (future *ExtensionsUpdateFuture) result(client ExtensionsClient) (e Extension, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + e.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.ExtensionsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if e.Response.Response, err = future.GetResult(sender); err == nil && e.Response.Response.StatusCode != http.StatusNoContent { + e, err = client.UpdateResponder(e.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.ExtensionsUpdateFuture", "Result", e.Response.Response, "Failure responding to request") + } + } + return +} + +// ExtensionType represents an Extension Type. +type ExtensionType struct { + autorest.Response `json:"-"` + // ExtensionTypeProperties - Describes the Resource Type properties. + *ExtensionTypeProperties `json:"properties,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + 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 ExtensionType. +func (et ExtensionType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if et.ExtensionTypeProperties != nil { + objectMap["properties"] = et.ExtensionTypeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for ExtensionType struct. +func (et *ExtensionType) 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 extensionTypeProperties ExtensionTypeProperties + err = json.Unmarshal(*v, &extensionTypeProperties) + if err != nil { + return err + } + et.ExtensionTypeProperties = &extensionTypeProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + et.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + et.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + et.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + et.Type = &typeVar + } + } + } + + return nil +} + +// ExtensionTypeList list Extension Types +type ExtensionTypeList struct { + autorest.Response `json:"-"` + // Value - The list of Extension Types + Value *[]ExtensionType `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` +} + +// ExtensionTypeListIterator provides access to a complete listing of ExtensionType values. +type ExtensionTypeListIterator struct { + i int + page ExtensionTypeListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionTypeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionTypeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionTypeListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionTypeListIterator) Response() ExtensionTypeList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionTypeListIterator) Value() ExtensionType { + if !iter.page.NotDone() { + return ExtensionType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionTypeListIterator type. +func NewExtensionTypeListIterator(page ExtensionTypeListPage) ExtensionTypeListIterator { + return ExtensionTypeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (etl ExtensionTypeList) IsEmpty() bool { + return etl.Value == nil || len(*etl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (etl ExtensionTypeList) hasNextLink() bool { + return etl.NextLink != nil && len(*etl.NextLink) != 0 +} + +// extensionTypeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (etl ExtensionTypeList) extensionTypeListPreparer(ctx context.Context) (*http.Request, error) { + if !etl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(etl.NextLink))) +} + +// ExtensionTypeListPage contains a page of ExtensionType values. +type ExtensionTypeListPage struct { + fn func(context.Context, ExtensionTypeList) (ExtensionTypeList, error) + etl ExtensionTypeList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionTypeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionTypeListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.etl) + if err != nil { + return err + } + page.etl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionTypeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionTypeListPage) NotDone() bool { + return !page.etl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionTypeListPage) Response() ExtensionTypeList { + return page.etl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionTypeListPage) Values() []ExtensionType { + if page.etl.IsEmpty() { + return nil + } + return *page.etl.Value +} + +// Creates a new instance of the ExtensionTypeListPage type. +func NewExtensionTypeListPage(cur ExtensionTypeList, getNextPage func(context.Context, ExtensionTypeList) (ExtensionTypeList, error)) ExtensionTypeListPage { + return ExtensionTypeListPage{ + fn: getNextPage, + etl: cur, + } +} + +// ExtensionTypeProperties properties of the connected cluster. +type ExtensionTypeProperties struct { + // ReleaseTrains - READ-ONLY; Extension release train: preview or stable + ReleaseTrains *[]string `json:"releaseTrains,omitempty"` + // ClusterTypes - READ-ONLY; Cluster types + ClusterTypes *[]string `json:"clusterTypes,omitempty"` + // SupportedScopes - READ-ONLY; Extension scopes + SupportedScopes *SupportedScopes `json:"supportedScopes,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionTypeProperties. +func (etp ExtensionTypeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ExtensionVersionList list versions for an Extension +type ExtensionVersionList struct { + autorest.Response `json:"-"` + // Value - Versions available for this Extension Type + Value *[]ExtensionVersionListValueItem `json:"value,omitempty"` + // NextLink - The link to fetch the next page of Extension Types + NextLink *string `json:"nextLink,omitempty"` + // SystemData - READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty"` +} + +// MarshalJSON is the custom marshaler for ExtensionVersionList. +func (evl ExtensionVersionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if evl.Value != nil { + objectMap["value"] = evl.Value + } + if evl.NextLink != nil { + objectMap["nextLink"] = evl.NextLink + } + return json.Marshal(objectMap) +} + +// ExtensionVersionListIterator provides access to a complete listing of ExtensionVersionListValueItem +// values. +type ExtensionVersionListIterator struct { + i int + page ExtensionVersionListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ExtensionVersionListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ExtensionVersionListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ExtensionVersionListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ExtensionVersionListIterator) Response() ExtensionVersionList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ExtensionVersionListIterator) Value() ExtensionVersionListValueItem { + if !iter.page.NotDone() { + return ExtensionVersionListValueItem{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ExtensionVersionListIterator type. +func NewExtensionVersionListIterator(page ExtensionVersionListPage) ExtensionVersionListIterator { + return ExtensionVersionListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (evl ExtensionVersionList) IsEmpty() bool { + return evl.Value == nil || len(*evl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (evl ExtensionVersionList) hasNextLink() bool { + return evl.NextLink != nil && len(*evl.NextLink) != 0 +} + +// extensionVersionListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (evl ExtensionVersionList) extensionVersionListPreparer(ctx context.Context) (*http.Request, error) { + if !evl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(evl.NextLink))) +} + +// ExtensionVersionListPage contains a page of ExtensionVersionListValueItem values. +type ExtensionVersionListPage struct { + fn func(context.Context, ExtensionVersionList) (ExtensionVersionList, error) + evl ExtensionVersionList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ExtensionVersionListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ExtensionVersionListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.evl) + if err != nil { + return err + } + page.evl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ExtensionVersionListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ExtensionVersionListPage) NotDone() bool { + return !page.evl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ExtensionVersionListPage) Response() ExtensionVersionList { + return page.evl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ExtensionVersionListPage) Values() []ExtensionVersionListValueItem { + if page.evl.IsEmpty() { + return nil + } + return *page.evl.Value +} + +// Creates a new instance of the ExtensionVersionListPage type. +func NewExtensionVersionListPage(cur ExtensionVersionList, getNextPage func(context.Context, ExtensionVersionList) (ExtensionVersionList, error)) ExtensionVersionListPage { + return ExtensionVersionListPage{ + fn: getNextPage, + evl: cur, + } +} + +// ExtensionVersionListValueItem ... +type ExtensionVersionListValueItem struct { + // ReleaseTrain - The release train for this Extension Type + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Versions - Versions available for this Extension Type and release train + Versions *[]string `json:"versions,omitempty"` +} + +// FluxConfiguration the Flux Configuration object returned in Get & Put response. +type FluxConfiguration struct { + autorest.Response `json:"-"` + // FluxConfigurationProperties - Properties to create a Flux Configuration resource + *FluxConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 FluxConfiguration. +func (fc FluxConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.FluxConfigurationProperties != nil { + objectMap["properties"] = fc.FluxConfigurationProperties + } + if fc.SystemData != nil { + objectMap["systemData"] = fc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfiguration struct. +func (fc *FluxConfiguration) 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 fluxConfigurationProperties FluxConfigurationProperties + err = json.Unmarshal(*v, &fluxConfigurationProperties) + if err != nil { + return err + } + fc.FluxConfigurationProperties = &fluxConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fc.Type = &typeVar + } + } + } + + return nil +} + +// FluxConfigurationPatch the Flux Configuration Patch Request object. +type FluxConfigurationPatch struct { + // FluxConfigurationPatchProperties - Updatable properties of an Flux Configuration Patch Request + *FluxConfigurationPatchProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatch. +func (fcp FluxConfigurationPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.FluxConfigurationPatchProperties != nil { + objectMap["properties"] = fcp.FluxConfigurationPatchProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for FluxConfigurationPatch struct. +func (fcp *FluxConfigurationPatch) 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 fluxConfigurationPatchProperties FluxConfigurationPatchProperties + err = json.Unmarshal(*v, &fluxConfigurationPatchProperties) + if err != nil { + return err + } + fcp.FluxConfigurationPatchProperties = &fluxConfigurationPatchProperties + } + } + } + + return nil +} + +// FluxConfigurationPatchProperties updatable properties of an Flux Configuration Patch Request +type FluxConfigurationPatchProperties struct { + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryPatchDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationPatchDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationPatchProperties. +func (fcp FluxConfigurationPatchProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fcp.SourceKind != "" { + objectMap["sourceKind"] = fcp.SourceKind + } + if fcp.Suspend != nil { + objectMap["suspend"] = fcp.Suspend + } + if fcp.GitRepository != nil { + objectMap["gitRepository"] = fcp.GitRepository + } + if fcp.Bucket != nil { + objectMap["bucket"] = fcp.Bucket + } + if fcp.Kustomizations != nil { + objectMap["kustomizations"] = fcp.Kustomizations + } + if fcp.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fcp.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationProperties properties to create a Flux Configuration resource +type FluxConfigurationProperties struct { + // Scope - Scope at which the operator will be installed. Possible values include: 'ScopeTypeCluster', 'ScopeTypeNamespace' + Scope ScopeType `json:"scope,omitempty"` + // Namespace - The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + Namespace *string `json:"namespace,omitempty"` + // SourceKind - Source Kind to pull the configuration data from. Possible values include: 'GitRepository', 'Bucket' + SourceKind SourceKindType `json:"sourceKind,omitempty"` + // Suspend - Whether this configuration should suspend its reconciliation of its kustomizations and sources. + Suspend *bool `json:"suspend,omitempty"` + // GitRepository - Parameters to reconcile to the GitRepository source kind type. + GitRepository *GitRepositoryDefinition `json:"gitRepository,omitempty"` + // Bucket - Parameters to reconcile to the Bucket source kind type. + Bucket *BucketDefinition `json:"bucket,omitempty"` + // Kustomizations - Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. + Kustomizations map[string]*KustomizationDefinition `json:"kustomizations"` + // ConfigurationProtectedSettings - Key-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // Statuses - READ-ONLY; Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. + Statuses *[]ObjectStatusDefinition `json:"statuses,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this fluxConfiguration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // LastSourceUpdatedCommitID - READ-ONLY; Branch and SHA of the last source commit synced with the cluster. + LastSourceUpdatedCommitID *string `json:"lastSourceUpdatedCommitId,omitempty"` + // LastSourceUpdatedAt - READ-ONLY; Datetime the fluxConfiguration last synced its source on the cluster. + LastSourceUpdatedAt *date.Time `json:"lastSourceUpdatedAt,omitempty"` + // ComplianceState - READ-ONLY; Combined status of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // ProvisioningState - READ-ONLY; Status of the creation of the fluxConfiguration. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreating', 'ProvisioningStateUpdating', 'ProvisioningStateDeleting' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ErrorMessage - READ-ONLY; Error message returned to the user in the case of provisioning failure. + ErrorMessage *string `json:"errorMessage,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationProperties. +func (fc FluxConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if fc.Scope != "" { + objectMap["scope"] = fc.Scope + } + if fc.Namespace != nil { + objectMap["namespace"] = fc.Namespace + } + if fc.SourceKind != "" { + objectMap["sourceKind"] = fc.SourceKind + } + if fc.Suspend != nil { + objectMap["suspend"] = fc.Suspend + } + if fc.GitRepository != nil { + objectMap["gitRepository"] = fc.GitRepository + } + if fc.Bucket != nil { + objectMap["bucket"] = fc.Bucket + } + if fc.Kustomizations != nil { + objectMap["kustomizations"] = fc.Kustomizations + } + if fc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = fc.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// FluxConfigurationsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsCreateOrUpdateFuture.Result. +func (future *FluxConfigurationsCreateOrUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.CreateOrUpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsCreateOrUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// FluxConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsDeleteFuture.Result. +func (future *FluxConfigurationsDeleteFuture) result(client FluxConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// FluxConfigurationsList result of the request to list Flux Configurations. It contains a list of +// FluxConfiguration objects and a URL link to get the next set of results. +type FluxConfigurationsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Flux Configurations within a Kubernetes cluster. + Value *[]FluxConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for FluxConfigurationsList. +func (fcl FluxConfigurationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// FluxConfigurationsListIterator provides access to a complete listing of FluxConfiguration values. +type FluxConfigurationsListIterator struct { + i int + page FluxConfigurationsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *FluxConfigurationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *FluxConfigurationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter FluxConfigurationsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter FluxConfigurationsListIterator) Response() FluxConfigurationsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter FluxConfigurationsListIterator) Value() FluxConfiguration { + if !iter.page.NotDone() { + return FluxConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the FluxConfigurationsListIterator type. +func NewFluxConfigurationsListIterator(page FluxConfigurationsListPage) FluxConfigurationsListIterator { + return FluxConfigurationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (fcl FluxConfigurationsList) IsEmpty() bool { + return fcl.Value == nil || len(*fcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (fcl FluxConfigurationsList) hasNextLink() bool { + return fcl.NextLink != nil && len(*fcl.NextLink) != 0 +} + +// fluxConfigurationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (fcl FluxConfigurationsList) fluxConfigurationsListPreparer(ctx context.Context) (*http.Request, error) { + if !fcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(fcl.NextLink))) +} + +// FluxConfigurationsListPage contains a page of FluxConfiguration values. +type FluxConfigurationsListPage struct { + fn func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error) + fcl FluxConfigurationsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *FluxConfigurationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/FluxConfigurationsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.fcl) + if err != nil { + return err + } + page.fcl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *FluxConfigurationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page FluxConfigurationsListPage) NotDone() bool { + return !page.fcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page FluxConfigurationsListPage) Response() FluxConfigurationsList { + return page.fcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page FluxConfigurationsListPage) Values() []FluxConfiguration { + if page.fcl.IsEmpty() { + return nil + } + return *page.fcl.Value +} + +// Creates a new instance of the FluxConfigurationsListPage type. +func NewFluxConfigurationsListPage(cur FluxConfigurationsList, getNextPage func(context.Context, FluxConfigurationsList) (FluxConfigurationsList, error)) FluxConfigurationsListPage { + return FluxConfigurationsListPage{ + fn: getNextPage, + fcl: cur, + } +} + +// FluxConfigurationsUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type FluxConfigurationsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(FluxConfigurationsClient) (FluxConfiguration, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *FluxConfigurationsUpdateFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for FluxConfigurationsUpdateFuture.Result. +func (future *FluxConfigurationsUpdateFuture) result(client FluxConfigurationsClient) (fc FluxConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + fc.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.FluxConfigurationsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if fc.Response.Response, err = future.GetResult(sender); err == nil && fc.Response.Response.StatusCode != http.StatusNoContent { + fc, err = client.UpdateResponder(fc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.FluxConfigurationsUpdateFuture", "Result", fc.Response.Response, "Failure responding to request") + } + } + return +} + +// GitRepositoryDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// GitRepositoryPatchDefinition parameters to reconcile to the GitRepository source kind type. +type GitRepositoryPatchDefinition struct { + // URL - The URL to sync for the flux configuration git repository. + URL *string `json:"url,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the cluster git repository source with the remote. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the cluster git repository source with the remote. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RepositoryRef - The source reference for the GitRepository object. + RepositoryRef *RepositoryRefDefinition `json:"repositoryRef,omitempty"` + // SSHKnownHosts - Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH + SSHKnownHosts *string `json:"sshKnownHosts,omitempty"` + // HTTPSUser - Plaintext HTTPS username used to access private git repositories over HTTPS + HTTPSUser *string `json:"httpsUser,omitempty"` + // HTTPSCACert - Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS + HTTPSCACert *string `json:"httpsCACert,omitempty"` + // LocalAuthRef - Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. + LocalAuthRef *string `json:"localAuthRef,omitempty"` +} + +// HelmOperatorProperties properties for Helm operator. +type HelmOperatorProperties struct { + // ChartVersion - Version of the operator Helm chart. + ChartVersion *string `json:"chartVersion,omitempty"` + // ChartValues - Values override for the operator Helm chart. + ChartValues *string `json:"chartValues,omitempty"` +} + +// HelmReleasePropertiesDefinition ... +type HelmReleasePropertiesDefinition struct { + // LastRevisionApplied - The revision number of the last released object change + LastRevisionApplied *int64 `json:"lastRevisionApplied,omitempty"` + // HelmChartRef - The reference to the HelmChart object used as the source to this HelmRelease + HelmChartRef *ObjectReferenceDefinition `json:"helmChartRef,omitempty"` + // FailureCount - Total number of times that the HelmRelease failed to install or upgrade + FailureCount *int64 `json:"failureCount,omitempty"` + // InstallFailureCount - Number of times that the HelmRelease failed to install + InstallFailureCount *int64 `json:"installFailureCount,omitempty"` + // UpgradeFailureCount - Number of times that the HelmRelease failed to upgrade + UpgradeFailureCount *int64 `json:"upgradeFailureCount,omitempty"` +} + +// Identity identity for the resource. +type Identity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if i.Type != "" { + objectMap["type"] = i.Type + } + return json.Marshal(objectMap) +} + +// KustomizationDefinition the Kustomization defining how to reconcile the artifact pulled by the source +// type on the cluster. +type KustomizationDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// KustomizationPatchDefinition the Kustomization defining how to reconcile the artifact pulled by the +// source type on the cluster. +type KustomizationPatchDefinition struct { + // Path - The path in the source reference to reconcile on the cluster. + Path *string `json:"path,omitempty"` + // DependsOn - Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. + DependsOn *[]DependsOnDefinition `json:"dependsOn,omitempty"` + // TimeoutInSeconds - The maximum time to attempt to reconcile the Kustomization on the cluster. + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + // SyncIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster. + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + // RetryIntervalInSeconds - The interval at which to re-reconcile the Kustomization on the cluster in the event of failure on reconciliation. + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + // Prune - Enable/disable garbage collections of Kubernetes objects created by this Kustomization. + Prune *bool `json:"prune,omitempty"` + // Force - Enable/disable re-creating Kubernetes resources on the cluster when patching fails due to an immutable field change. + Force *bool `json:"force,omitempty"` +} + +// ObjectReferenceDefinition object reference to a Kubernetes object on a cluster +type ObjectReferenceDefinition struct { + // Name - Name of the object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the object + Namespace *string `json:"namespace,omitempty"` +} + +// ObjectStatusConditionDefinition status condition of Kubernetes object +type ObjectStatusConditionDefinition struct { + // LastTransitionTime - Last time this status condition has changed + LastTransitionTime *date.Time `json:"lastTransitionTime,omitempty"` + // Message - A more verbose description of the object status condition + Message *string `json:"message,omitempty"` + // Reason - Reason for the specified status condition type status + Reason *string `json:"reason,omitempty"` + // Status - Status of the Kubernetes object condition type + Status *string `json:"status,omitempty"` + // Type - Object status condition type for this object + Type *string `json:"type,omitempty"` +} + +// ObjectStatusDefinition statuses of objects deployed by the user-specified kustomizations from the git +// repository. +type ObjectStatusDefinition struct { + // Name - Name of the applied object + Name *string `json:"name,omitempty"` + // Namespace - Namespace of the applied object + Namespace *string `json:"namespace,omitempty"` + // Kind - Kind of the applied object + Kind *string `json:"kind,omitempty"` + // ComplianceState - Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: 'FluxComplianceStateCompliant', 'FluxComplianceStateNonCompliant', 'FluxComplianceStatePending', 'FluxComplianceStateSuspended', 'FluxComplianceStateUnknown' + ComplianceState FluxComplianceState `json:"complianceState,omitempty"` + // AppliedBy - Object reference to the Kustomization that applied this object + AppliedBy *ObjectReferenceDefinition `json:"appliedBy,omitempty"` + // StatusConditions - List of Kubernetes object status conditions present on the cluster + StatusConditions *[]ObjectStatusConditionDefinition `json:"statusConditions,omitempty"` + // HelmReleaseProperties - Additional properties that are provided from objects of the HelmRelease kind + HelmReleaseProperties *HelmReleasePropertiesDefinition `json:"helmReleaseProperties,omitempty"` +} + +// OperationStatusList the async operations in progress, in the cluster. +type OperationStatusList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of async operations in progress, in the cluster. + Value *[]OperationStatusResult `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of Operation Result objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusList. +func (osl OperationStatusList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// OperationStatusListIterator provides access to a complete listing of OperationStatusResult values. +type OperationStatusListIterator struct { + i int + page OperationStatusListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationStatusListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationStatusListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationStatusListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationStatusListIterator) Response() OperationStatusList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationStatusListIterator) Value() OperationStatusResult { + if !iter.page.NotDone() { + return OperationStatusResult{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationStatusListIterator type. +func NewOperationStatusListIterator(page OperationStatusListPage) OperationStatusListIterator { + return OperationStatusListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (osl OperationStatusList) IsEmpty() bool { + return osl.Value == nil || len(*osl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (osl OperationStatusList) hasNextLink() bool { + return osl.NextLink != nil && len(*osl.NextLink) != 0 +} + +// operationStatusListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (osl OperationStatusList) operationStatusListPreparer(ctx context.Context) (*http.Request, error) { + if !osl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(osl.NextLink))) +} + +// OperationStatusListPage contains a page of OperationStatusResult values. +type OperationStatusListPage struct { + fn func(context.Context, OperationStatusList) (OperationStatusList, error) + osl OperationStatusList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationStatusListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.osl) + if err != nil { + return err + } + page.osl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationStatusListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationStatusListPage) NotDone() bool { + return !page.osl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationStatusListPage) Response() OperationStatusList { + return page.osl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationStatusListPage) Values() []OperationStatusResult { + if page.osl.IsEmpty() { + return nil + } + return *page.osl.Value +} + +// Creates a new instance of the OperationStatusListPage type. +func NewOperationStatusListPage(cur OperationStatusList, getNextPage func(context.Context, OperationStatusList) (OperationStatusList, error)) OperationStatusListPage { + return OperationStatusListPage{ + fn: getNextPage, + osl: cur, + } +} + +// OperationStatusResult the current status of an async operation. +type OperationStatusResult struct { + autorest.Response `json:"-"` + // ID - Fully qualified ID for the async operation. + ID *string `json:"id,omitempty"` + // Name - Name of the async operation. + Name *string `json:"name,omitempty"` + // Status - Operation status. + Status *string `json:"status,omitempty"` + // Properties - Additional information, if available. + Properties map[string]*string `json:"properties"` + // Error - READ-ONLY; If present, details of the operation error. + Error *ErrorDetail `json:"error,omitempty"` +} + +// MarshalJSON is the custom marshaler for OperationStatusResult. +func (osr OperationStatusResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osr.ID != nil { + objectMap["id"] = osr.ID + } + if osr.Name != nil { + objectMap["name"] = osr.Name + } + if osr.Status != nil { + objectMap["status"] = osr.Status + } + if osr.Properties != nil { + objectMap["properties"] = osr.Properties + } + return json.Marshal(objectMap) +} + +// PatchExtension the Extension Patch Request object. +type PatchExtension struct { + // PatchExtensionProperties - Updatable properties of an Extension Patch Request + *PatchExtensionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for PatchExtension. +func (peVar PatchExtension) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.PatchExtensionProperties != nil { + objectMap["properties"] = peVar.PatchExtensionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PatchExtension struct. +func (peVar *PatchExtension) 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 patchExtensionProperties PatchExtensionProperties + err = json.Unmarshal(*v, &patchExtensionProperties) + if err != nil { + return err + } + peVar.PatchExtensionProperties = &patchExtensionProperties + } + } + } + + return nil +} + +// PatchExtensionProperties updatable properties of an Extension Patch Request +type PatchExtensionProperties struct { + // AutoUpgradeMinorVersion - Flag to note if this extension participates in auto upgrade of minor version, or not. + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + // ReleaseTrain - ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + ReleaseTrain *string `json:"releaseTrain,omitempty"` + // Version - Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. + Version *string `json:"version,omitempty"` + // ConfigurationSettings - Configuration settings, as name-value pairs for configuring this extension. + ConfigurationSettings map[string]*string `json:"configurationSettings"` + // ConfigurationProtectedSettings - Configuration settings that are sensitive, as name-value pairs for configuring this extension. + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` +} + +// MarshalJSON is the custom marshaler for PatchExtensionProperties. +func (peVar PatchExtensionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if peVar.AutoUpgradeMinorVersion != nil { + objectMap["autoUpgradeMinorVersion"] = peVar.AutoUpgradeMinorVersion + } + if peVar.ReleaseTrain != nil { + objectMap["releaseTrain"] = peVar.ReleaseTrain + } + if peVar.Version != nil { + objectMap["version"] = peVar.Version + } + if peVar.ConfigurationSettings != nil { + objectMap["configurationSettings"] = peVar.ConfigurationSettings + } + if peVar.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = peVar.ConfigurationProtectedSettings + } + return json.Marshal(objectMap) +} + +// Plan plan for the resource. +type Plan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// 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"` + // 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 ProxyResource. +func (pr ProxyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// RepositoryRefDefinition the source reference for the GitRepository object. +type RepositoryRefDefinition struct { + // Branch - The git repository branch name to checkout. + Branch *string `json:"branch,omitempty"` + // Tag - The git repository tag name to checkout. This takes precedence over branch. + Tag *string `json:"tag,omitempty"` + // Semver - The semver range used to match against git repository tags. This takes precedence over tag. + Semver *string `json:"semver,omitempty"` + // Commit - The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. + Commit *string `json:"commit,omitempty"` +} + +// Resource common fields that are returned in the response for all Azure Resource Manager resources +type Resource 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"` + // 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySet the resource model definition containing the full set of allowed +// properties for a resource. Except properties bag, there cannot be a top level property outside of this +// set. +type ResourceModelWithAllowedPropertySet 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"` + // 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. + ManagedBy *string `json:"managedBy,omitempty"` + // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. + Kind *string `json:"kind,omitempty"` + // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` + Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` + Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. +func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } + if rmwaps.ManagedBy != nil { + objectMap["managedBy"] = rmwaps.ManagedBy + } + if rmwaps.Kind != nil { + objectMap["kind"] = rmwaps.Kind + } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Identity != nil { + objectMap["identity"] = rmwaps.Identity + } + if rmwaps.Sku != nil { + objectMap["sku"] = rmwaps.Sku + } + if rmwaps.Plan != nil { + objectMap["plan"] = rmwaps.Plan + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetIdentity ... +type ResourceModelWithAllowedPropertySetIdentity struct { + // PrincipalID - READ-ONLY; The principal ID of resource identity. + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; The tenant ID of resource. + TenantID *string `json:"tenantId,omitempty"` + // Type - The identity type. Possible values include: 'SystemAssigned' + Type ResourceIdentityType `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySetIdentity. +func (rmwaps ResourceModelWithAllowedPropertySetIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rmwaps.Type != "" { + objectMap["type"] = rmwaps.Type + } + return json.Marshal(objectMap) +} + +// ResourceModelWithAllowedPropertySetPlan ... +type ResourceModelWithAllowedPropertySetPlan struct { + // Name - A user defined name of the 3rd Party Artifact that is being procured. + Name *string `json:"name,omitempty"` + // Publisher - The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + Publisher *string `json:"publisher,omitempty"` + // Product - The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + Product *string `json:"product,omitempty"` + // PromotionCode - A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + PromotionCode *string `json:"promotionCode,omitempty"` + // Version - The version of the desired product/artifact. + Version *string `json:"version,omitempty"` +} + +// ResourceModelWithAllowedPropertySetSku ... +type ResourceModelWithAllowedPropertySetSku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// ResourceProviderOperation supported operation of this resource provider. +type ResourceProviderOperation struct { + // Name - Operation name, in format of {provider}/{resource}/{operation} + Name *string `json:"name,omitempty"` + // Display - Display metadata associated with the operation. + Display *ResourceProviderOperationDisplay `json:"display,omitempty"` + // IsDataAction - READ-ONLY; The flag that indicates whether the operation applies to data plane. + IsDataAction *bool `json:"isDataAction,omitempty"` + // Origin - READ-ONLY; Origin of the operation + Origin *string `json:"origin,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperation. +func (rpo ResourceProviderOperation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpo.Name != nil { + objectMap["name"] = rpo.Name + } + if rpo.Display != nil { + objectMap["display"] = rpo.Display + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationDisplay display metadata associated with the operation. +type ResourceProviderOperationDisplay struct { + // Provider - Resource provider: Microsoft KubernetesConfiguration. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Type of operation: get, read, delete, etc. + Operation *string `json:"operation,omitempty"` + // Description - Description of this operation. + Description *string `json:"description,omitempty"` +} + +// ResourceProviderOperationList result of the request to list operations. +type ResourceProviderOperationList struct { + autorest.Response `json:"-"` + // Value - List of operations supported by this resource provider. + Value *[]ResourceProviderOperation `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to the next set of results, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProviderOperationList. +func (rpol ResourceProviderOperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rpol.Value != nil { + objectMap["value"] = rpol.Value + } + return json.Marshal(objectMap) +} + +// ResourceProviderOperationListIterator provides access to a complete listing of ResourceProviderOperation +// values. +type ResourceProviderOperationListIterator struct { + i int + page ResourceProviderOperationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ResourceProviderOperationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ResourceProviderOperationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceProviderOperationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ResourceProviderOperationListIterator) Response() ResourceProviderOperationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ResourceProviderOperationListIterator) Value() ResourceProviderOperation { + if !iter.page.NotDone() { + return ResourceProviderOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceProviderOperationListIterator type. +func NewResourceProviderOperationListIterator(page ResourceProviderOperationListPage) ResourceProviderOperationListIterator { + return ResourceProviderOperationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rpol ResourceProviderOperationList) IsEmpty() bool { + return rpol.Value == nil || len(*rpol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rpol ResourceProviderOperationList) hasNextLink() bool { + return rpol.NextLink != nil && len(*rpol.NextLink) != 0 +} + +// resourceProviderOperationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rpol ResourceProviderOperationList) resourceProviderOperationListPreparer(ctx context.Context) (*http.Request, error) { + if !rpol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rpol.NextLink))) +} + +// ResourceProviderOperationListPage contains a page of ResourceProviderOperation values. +type ResourceProviderOperationListPage struct { + fn func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error) + rpol ResourceProviderOperationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ResourceProviderOperationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceProviderOperationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rpol) + if err != nil { + return err + } + page.rpol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ResourceProviderOperationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceProviderOperationListPage) NotDone() bool { + return !page.rpol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceProviderOperationListPage) Response() ResourceProviderOperationList { + return page.rpol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceProviderOperationListPage) Values() []ResourceProviderOperation { + if page.rpol.IsEmpty() { + return nil + } + return *page.rpol.Value +} + +// Creates a new instance of the ResourceProviderOperationListPage type. +func NewResourceProviderOperationListPage(cur ResourceProviderOperationList, getNextPage func(context.Context, ResourceProviderOperationList) (ResourceProviderOperationList, error)) ResourceProviderOperationListPage { + return ResourceProviderOperationListPage{ + fn: getNextPage, + rpol: cur, + } +} + +// Scope scope of the extension. It can be either Cluster or Namespace; but not both. +type Scope struct { + // Cluster - Specifies that the scope of the extension is Cluster + Cluster *ScopeCluster `json:"cluster,omitempty"` + // Namespace - Specifies that the scope of the extension is Namespace + Namespace *ScopeNamespace `json:"namespace,omitempty"` +} + +// ScopeCluster specifies that the scope of the extension is Cluster +type ScopeCluster struct { + // ReleaseNamespace - Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created + ReleaseNamespace *string `json:"releaseNamespace,omitempty"` +} + +// ScopeNamespace specifies that the scope of the extension is Namespace +type ScopeNamespace struct { + // TargetNamespace - Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created + TargetNamespace *string `json:"targetNamespace,omitempty"` +} + +// Sku the resource model definition representing SKU +type Sku struct { + // Name - The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string `json:"name,omitempty"` + // Tier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' + Tier SkuTier `json:"tier,omitempty"` + // Size - The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string `json:"size,omitempty"` + // Family - If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string `json:"family,omitempty"` + // Capacity - If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + Capacity *int32 `json:"capacity,omitempty"` +} + +// SourceControlConfiguration the SourceControl Configuration object returned in Get & Put response. +type SourceControlConfiguration struct { + autorest.Response `json:"-"` + // SourceControlConfigurationProperties - Properties to create a Source Control Configuration resource + *SourceControlConfigurationProperties `json:"properties,omitempty"` + // SystemData - Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + 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 SourceControlConfiguration. +func (scc SourceControlConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.SourceControlConfigurationProperties != nil { + objectMap["properties"] = scc.SourceControlConfigurationProperties + } + if scc.SystemData != nil { + objectMap["systemData"] = scc.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SourceControlConfiguration struct. +func (scc *SourceControlConfiguration) 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 sourceControlConfigurationProperties SourceControlConfigurationProperties + err = json.Unmarshal(*v, &sourceControlConfigurationProperties) + if err != nil { + return err + } + scc.SourceControlConfigurationProperties = &sourceControlConfigurationProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + scc.SystemData = &systemData + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + scc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + scc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + scc.Type = &typeVar + } + } + } + + return nil +} + +// SourceControlConfigurationList result of the request to list Source Control Configurations. It contains +// a list of SourceControlConfiguration objects and a URL link to get the next set of results. +type SourceControlConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of Source Control Configurations within a Kubernetes cluster. + Value *[]SourceControlConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; URL to get the next set of configuration objects, if any. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationList. +func (sccl SourceControlConfigurationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// SourceControlConfigurationListIterator provides access to a complete listing of +// SourceControlConfiguration values. +type SourceControlConfigurationListIterator struct { + i int + page SourceControlConfigurationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SourceControlConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SourceControlConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SourceControlConfigurationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SourceControlConfigurationListIterator) Response() SourceControlConfigurationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SourceControlConfigurationListIterator) Value() SourceControlConfiguration { + if !iter.page.NotDone() { + return SourceControlConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SourceControlConfigurationListIterator type. +func NewSourceControlConfigurationListIterator(page SourceControlConfigurationListPage) SourceControlConfigurationListIterator { + return SourceControlConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sccl SourceControlConfigurationList) IsEmpty() bool { + return sccl.Value == nil || len(*sccl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sccl SourceControlConfigurationList) hasNextLink() bool { + return sccl.NextLink != nil && len(*sccl.NextLink) != 0 +} + +// sourceControlConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sccl SourceControlConfigurationList) sourceControlConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !sccl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sccl.NextLink))) +} + +// SourceControlConfigurationListPage contains a page of SourceControlConfiguration values. +type SourceControlConfigurationListPage struct { + fn func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error) + sccl SourceControlConfigurationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SourceControlConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sccl) + if err != nil { + return err + } + page.sccl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SourceControlConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SourceControlConfigurationListPage) NotDone() bool { + return !page.sccl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SourceControlConfigurationListPage) Response() SourceControlConfigurationList { + return page.sccl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SourceControlConfigurationListPage) Values() []SourceControlConfiguration { + if page.sccl.IsEmpty() { + return nil + } + return *page.sccl.Value +} + +// Creates a new instance of the SourceControlConfigurationListPage type. +func NewSourceControlConfigurationListPage(cur SourceControlConfigurationList, getNextPage func(context.Context, SourceControlConfigurationList) (SourceControlConfigurationList, error)) SourceControlConfigurationListPage { + return SourceControlConfigurationListPage{ + fn: getNextPage, + sccl: cur, + } +} + +// SourceControlConfigurationProperties properties to create a Source Control Configuration resource +type SourceControlConfigurationProperties struct { + // RepositoryURL - Url of the SourceControl Repository. + RepositoryURL *string `json:"repositoryUrl,omitempty"` + // OperatorNamespace - The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. + OperatorNamespace *string `json:"operatorNamespace,omitempty"` + // OperatorInstanceName - Instance name of the operator - identifying the specific configuration. + OperatorInstanceName *string `json:"operatorInstanceName,omitempty"` + // OperatorType - Type of the operator. Possible values include: 'Flux' + OperatorType OperatorType `json:"operatorType,omitempty"` + // OperatorParams - Any Parameters for the Operator instance in string format. + OperatorParams *string `json:"operatorParams,omitempty"` + // ConfigurationProtectedSettings - Name-value pairs of protected configuration settings for the configuration + ConfigurationProtectedSettings map[string]*string `json:"configurationProtectedSettings"` + // OperatorScope - Scope at which the operator will be installed. Possible values include: 'Cluster', 'Namespace' + OperatorScope OperatorScopeType `json:"operatorScope,omitempty"` + // RepositoryPublicKey - READ-ONLY; Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). + RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` + // SSHKnownHostsContents - Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances + SSHKnownHostsContents *string `json:"sshKnownHostsContents,omitempty"` + // EnableHelmOperator - Option to enable Helm Operator for this git configuration. + EnableHelmOperator *bool `json:"enableHelmOperator,omitempty"` + // HelmOperatorProperties - Properties for Helm operator. + HelmOperatorProperties *HelmOperatorProperties `json:"helmOperatorProperties,omitempty"` + // ProvisioningState - READ-ONLY; The provisioning state of the resource provider. Possible values include: 'ProvisioningStateTypeAccepted', 'ProvisioningStateTypeDeleting', 'ProvisioningStateTypeRunning', 'ProvisioningStateTypeSucceeded', 'ProvisioningStateTypeFailed' + ProvisioningState ProvisioningStateType `json:"provisioningState,omitempty"` + // ComplianceStatus - READ-ONLY; Compliance Status of the Configuration + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for SourceControlConfigurationProperties. +func (scc SourceControlConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if scc.RepositoryURL != nil { + objectMap["repositoryUrl"] = scc.RepositoryURL + } + if scc.OperatorNamespace != nil { + objectMap["operatorNamespace"] = scc.OperatorNamespace + } + if scc.OperatorInstanceName != nil { + objectMap["operatorInstanceName"] = scc.OperatorInstanceName + } + if scc.OperatorType != "" { + objectMap["operatorType"] = scc.OperatorType + } + if scc.OperatorParams != nil { + objectMap["operatorParams"] = scc.OperatorParams + } + if scc.ConfigurationProtectedSettings != nil { + objectMap["configurationProtectedSettings"] = scc.ConfigurationProtectedSettings + } + if scc.OperatorScope != "" { + objectMap["operatorScope"] = scc.OperatorScope + } + if scc.SSHKnownHostsContents != nil { + objectMap["sshKnownHostsContents"] = scc.SSHKnownHostsContents + } + if scc.EnableHelmOperator != nil { + objectMap["enableHelmOperator"] = scc.EnableHelmOperator + } + if scc.HelmOperatorProperties != nil { + objectMap["helmOperatorProperties"] = scc.HelmOperatorProperties + } + return json.Marshal(objectMap) +} + +// SourceControlConfigurationsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SourceControlConfigurationsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SourceControlConfigurationsClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SourceControlConfigurationsDeleteFuture) UnmarshalJSON(body []byte) error { + var azFuture azure.Future + if err := json.Unmarshal(body, &azFuture); err != nil { + return err + } + future.FutureAPI = &azFuture + future.Result = future.result + return nil +} + +// result is the default implementation for SourceControlConfigurationsDeleteFuture.Result. +func (future *SourceControlConfigurationsDeleteFuture) result(client SourceControlConfigurationsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("kubernetesconfiguration.SourceControlConfigurationsDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SupportedScopes extension scopes +type SupportedScopes struct { + // DefaultScope - Default extension scopes: cluster or namespace + DefaultScope *string `json:"defaultScope,omitempty"` + // ClusterScopeSettings - Scope settings + ClusterScopeSettings *ClusterScopeSettings `json:"clusterScopeSettings,omitempty"` +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// 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"` + // Location - The geo-location where the resource lives + Location *string `json:"location,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 TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operations.go new file mode 100644 index 000000000000..b08a45c050b4 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operations.go @@ -0,0 +1,140 @@ +package kubernetesconfiguration + +// 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/tracing" + "net/http" +) + +// OperationsClient is the kubernetesConfiguration Client +type OperationsClient struct { + BaseClient +} + +// NewOperationsClient creates an instance of the OperationsClient client. +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List list all the available operations the KubernetesConfiguration resource provider supports. +func (client OperationsClient) List(ctx context.Context) (result ResourceProviderOperationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.rpol.Response.Response != nil { + sc = result.rpol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rpol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.rpol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.rpol.hasNextLink() && result.rpol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.KubernetesConfiguration/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationsClient) ListResponder(resp *http.Response) (result ResourceProviderOperationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults ResourceProviderOperationList) (result ResourceProviderOperationList, err error) { + req, err := lastResults.resourceProviderOperationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result ResourceProviderOperationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operationstatus.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operationstatus.go new file mode 100644 index 000000000000..0a88f703e9e9 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/operationstatus.go @@ -0,0 +1,260 @@ +package kubernetesconfiguration + +// 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" +) + +// OperationStatusClient is the kubernetesConfiguration Client +type OperationStatusClient struct { + BaseClient +} + +// NewOperationStatusClient creates an instance of the OperationStatusClient client. +func NewOperationStatusClient(subscriptionID string) OperationStatusClient { + return NewOperationStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationStatusClientWithBaseURI creates an instance of the OperationStatusClient 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 NewOperationStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationStatusClient { + return OperationStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get Async Operation status +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// extensionName - name of the Extension. +// operationID - operation Id +func (client OperationStatusClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (result OperationStatusResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.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("kubernetesconfiguration.OperationStatusClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationStatusClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, extensionName string, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "extensionName": autorest.Encode("path", extensionName), + "operationId": autorest.Encode("path", operationID), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}", 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 OperationStatusClient) 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 OperationStatusClient) GetResponder(resp *http.Response) (result OperationStatusResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list Async Operations, currently in progress, in a cluster +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client OperationStatusClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.osl.Response.Response != nil { + sc = result.osl.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("kubernetesconfiguration.OperationStatusClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.osl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure sending request") + return + } + + result.osl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "List", resp, "Failure responding to request") + return + } + if result.osl.hasNextLink() && result.osl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationStatusClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client OperationStatusClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client OperationStatusClient) ListResponder(resp *http.Response) (result OperationStatusList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationStatusClient) listNextResults(ctx context.Context, lastResults OperationStatusList) (result OperationStatusList, err error) { + req, err := lastResults.operationStatusListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.OperationStatusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationStatusClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result OperationStatusListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationStatusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/sourcecontrolconfigurations.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/sourcecontrolconfigurations.go new file mode 100644 index 000000000000..bf36d87ae8b2 --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/sourcecontrolconfigurations.go @@ -0,0 +1,451 @@ +package kubernetesconfiguration + +// 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" +) + +// SourceControlConfigurationsClient is the kubernetesConfiguration Client +type SourceControlConfigurationsClient struct { + BaseClient +} + +// NewSourceControlConfigurationsClient creates an instance of the SourceControlConfigurationsClient client. +func NewSourceControlConfigurationsClient(subscriptionID string) SourceControlConfigurationsClient { + return NewSourceControlConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSourceControlConfigurationsClientWithBaseURI creates an instance of the SourceControlConfigurationsClient 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 NewSourceControlConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) SourceControlConfigurationsClient { + return SourceControlConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new Kubernetes Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +// sourceControlConfiguration - properties necessary to Create KubernetesConfiguration. +func (client SourceControlConfigurationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, sourceControlConfiguration) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SourceControlConfigurationsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string, sourceControlConfiguration SourceControlConfiguration) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", pathParameters), + autorest.WithJSON(sourceControlConfiguration), + 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) CreateOrUpdateResponder(resp *http.Response) (result SourceControlConfiguration, 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 this will delete the YAML file used to set up the Source control configuration, thus stopping future sync +// from the source repo. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Delete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfigurationsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.Delete") + defer func() { + sc := -1 + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SourceControlConfigurationsClient) DeletePreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) DeleteSender(req *http.Request) (future SourceControlConfigurationsDeleteFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) 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 gets details of the Source Control Configuration. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +// sourceControlConfigurationName - name of the Source Control Configuration. +func (client SourceControlConfigurationsClient) Get(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (result SourceControlConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.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("kubernetesconfiguration.SourceControlConfigurationsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SourceControlConfigurationsClient) GetPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string, sourceControlConfigurationName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "sourceControlConfigurationName": autorest.Encode("path", sourceControlConfigurationName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}", 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 SourceControlConfigurationsClient) 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 SourceControlConfigurationsClient) GetResponder(resp *http.Response) (result SourceControlConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list all Source Control Configurations. +// Parameters: +// resourceGroupName - the name of the resource group. The name is case insensitive. +// clusterRp - the Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or +// Microsoft.Kubernetes (for OnPrem K8S clusters). +// clusterResourceName - the Kubernetes cluster resource name - either managedClusters (for AKS clusters) or +// connectedClusters (for OnPrem K8S clusters). +// clusterName - the name of the kubernetes cluster. +func (client SourceControlConfigurationsClient) List(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.sccl.Response.Response != nil { + sc = result.sccl.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("kubernetesconfiguration.SourceControlConfigurationsClient", "List", err.Error()) + } + + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sccl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure sending request") + return + } + + result.sccl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "List", resp, "Failure responding to request") + return + } + if result.sccl.hasNextLink() && result.sccl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client SourceControlConfigurationsClient) ListPreparer(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "clusterName": autorest.Encode("path", clusterName), + "clusterResourceName": autorest.Encode("path", clusterResourceName), + "clusterRp": autorest.Encode("path", clusterRp), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client SourceControlConfigurationsClient) ListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client SourceControlConfigurationsClient) ListResponder(resp *http.Response) (result SourceControlConfigurationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client SourceControlConfigurationsClient) listNextResults(ctx context.Context, lastResults SourceControlConfigurationList) (result SourceControlConfigurationList, err error) { + req, err := lastResults.sourceControlConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "kubernetesconfiguration.SourceControlConfigurationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client SourceControlConfigurationsClient) ListComplete(ctx context.Context, resourceGroupName string, clusterRp ExtensionsClusterRp, clusterResourceName ExtensionsClusterResourceName, clusterName string) (result SourceControlConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SourceControlConfigurationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, resourceGroupName, clusterRp, clusterResourceName, clusterName) + return +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/version.go b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/version.go new file mode 100644 index 000000000000..32a827004e3e --- /dev/null +++ b/services/preview/kubernetesconfiguration/mgmt/2022-01-15-preview/kubernetesconfiguration/version.go @@ -0,0 +1,19 @@ +package kubernetesconfiguration + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " kubernetesconfiguration/2022-01-15-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +} diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md index 52911e4cc5e4..27e39b27707d 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md +++ b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. ResourceModelWithAllowedPropertySet.SystemData diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json index 5bc03d55769e..20365c409dd8 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json +++ b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "9d8640319ef481ae301b67b033d6ae0bd30422c3", + "commit": "6b99a68f01d4ff7da9fcf5d6d315652ebc1d3031", "readme": "/_/azure-rest-api-specs/specification/kubernetesconfiguration/resource-manager/readme.md", "tag": "package-preview-2022-04", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go index 057c0bd032eb..c8d70f872bf3 100644 --- a/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go +++ b/services/preview/kubernetesconfiguration/mgmt/2022-04-02-preview/kubernetesconfiguration/models.go @@ -2260,42 +2260,38 @@ func (r Resource) MarshalJSON() ([]byte, error) { // properties for a resource. Except properties bag, there cannot be a top level property outside of this // set. type ResourceModelWithAllowedPropertySet 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"` - // 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"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` // ManagedBy - The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. ManagedBy *string `json:"managedBy,omitempty"` // Kind - Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. Kind *string `json:"kind,omitempty"` // Etag - READ-ONLY; The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - Etag *string `json:"etag,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` + Etag *string `json:"etag,omitempty"` Identity *ResourceModelWithAllowedPropertySetIdentity `json:"identity,omitempty"` Sku *ResourceModelWithAllowedPropertySetSku `json:"sku,omitempty"` Plan *ResourceModelWithAllowedPropertySetPlan `json:"plan,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty"` } // MarshalJSON is the custom marshaler for ResourceModelWithAllowedPropertySet. func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rmwaps.Location != nil { - objectMap["location"] = rmwaps.Location - } if rmwaps.ManagedBy != nil { objectMap["managedBy"] = rmwaps.ManagedBy } if rmwaps.Kind != nil { objectMap["kind"] = rmwaps.Kind } - if rmwaps.Tags != nil { - objectMap["tags"] = rmwaps.Tags - } if rmwaps.Identity != nil { objectMap["identity"] = rmwaps.Identity } @@ -2305,6 +2301,12 @@ func (rmwaps ResourceModelWithAllowedPropertySet) MarshalJSON() ([]byte, error) if rmwaps.Plan != nil { objectMap["plan"] = rmwaps.Plan } + if rmwaps.Tags != nil { + objectMap["tags"] = rmwaps.Tags + } + if rmwaps.Location != nil { + objectMap["location"] = rmwaps.Location + } return json.Marshal(objectMap) }