diff --git a/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md b/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md +++ b/services/datadog/mgmt/2021-03-01/datadog/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/datadog/mgmt/2021-03-01/datadog/_meta.json b/services/datadog/mgmt/2021-03-01/datadog/_meta.json index 0d1161e7c8bc..479477d48f7c 100644 --- a/services/datadog/mgmt/2021-03-01/datadog/_meta.json +++ b/services/datadog/mgmt/2021-03-01/datadog/_meta.json @@ -1,5 +1,5 @@ { - "commit": "394395ed0bdc1c5c05cb37a031379ca03bfebbb5", + "commit": "df2d8df906b4807729a88c44c6ece62925811b80", "readme": "/_/azure-rest-api-specs/specification/datadog/resource-manager/readme.md", "tag": "package-2021-03", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/datadog/mgmt/2021-03-01/datadog/monitors.go b/services/datadog/mgmt/2021-03-01/datadog/monitors.go index f89c95093f41..52f0ba776354 100644 --- a/services/datadog/mgmt/2021-03-01/datadog/monitors.go +++ b/services/datadog/mgmt/2021-03-01/datadog/monitors.go @@ -51,8 +51,7 @@ func (client MonitorsClient) Create(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}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Sku", Name: validation.Null, Rule: false, @@ -165,8 +164,7 @@ func (client MonitorsClient) 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("datadog.MonitorsClient", "Delete", err.Error()) } @@ -253,8 +251,7 @@ func (client MonitorsClient) 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("datadog.MonitorsClient", "Get", err.Error()) } @@ -339,8 +336,7 @@ func (client MonitorsClient) GetDefaultKey(ctx context.Context, resourceGroupNam 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("datadog.MonitorsClient", "GetDefaultKey", err.Error()) } @@ -544,8 +540,7 @@ func (client MonitorsClient) ListAPIKeys(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("datadog.MonitorsClient", "ListAPIKeys", err.Error()) } @@ -671,8 +666,7 @@ func (client MonitorsClient) ListByResourceGroup(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("datadog.MonitorsClient", "ListByResourceGroup", err.Error()) } @@ -798,8 +792,7 @@ func (client MonitorsClient) ListHosts(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("datadog.MonitorsClient", "ListHosts", err.Error()) } @@ -926,8 +919,7 @@ func (client MonitorsClient) ListLinkedResources(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("datadog.MonitorsClient", "ListLinkedResources", err.Error()) } @@ -1054,8 +1046,7 @@ func (client MonitorsClient) ListMonitoredResources(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("datadog.MonitorsClient", "ListMonitoredResources", err.Error()) } @@ -1182,8 +1173,7 @@ func (client MonitorsClient) RefreshSetPasswordLink(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("datadog.MonitorsClient", "RefreshSetPasswordLink", err.Error()) } @@ -1268,8 +1258,7 @@ func (client MonitorsClient) SetDefaultKey(ctx context.Context, resourceGroupNam 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: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Key", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { @@ -1361,8 +1350,7 @@ func (client MonitorsClient) Update(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("datadog.MonitorsClient", "Update", err.Error()) } diff --git a/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go b/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go index e660f292e3f9..e6e510d54034 100644 --- a/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go +++ b/services/datadog/mgmt/2021-03-01/datadog/singlesignonconfigurations.go @@ -53,8 +53,7 @@ func (client SingleSignOnConfigurationsClient) CreateOrUpdate(ctx context.Contex 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("datadog.SingleSignOnConfigurationsClient", "CreateOrUpdate", err.Error()) } @@ -153,8 +152,7 @@ func (client SingleSignOnConfigurationsClient) Get(ctx context.Context, resource 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("datadog.SingleSignOnConfigurationsClient", "Get", err.Error()) } @@ -240,8 +238,7 @@ func (client SingleSignOnConfigurationsClient) List(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("datadog.SingleSignOnConfigurationsClient", "List", err.Error()) } diff --git a/services/datadog/mgmt/2021-03-01/datadog/tagrules.go b/services/datadog/mgmt/2021-03-01/datadog/tagrules.go index 475a400f790b..ae4141fba6ef 100644 --- a/services/datadog/mgmt/2021-03-01/datadog/tagrules.go +++ b/services/datadog/mgmt/2021-03-01/datadog/tagrules.go @@ -52,8 +52,7 @@ func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupNa 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("datadog.TagRulesClient", "CreateOrUpdate", err.Error()) } @@ -149,8 +148,7 @@ func (client TagRulesClient) 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("datadog.TagRulesClient", "Get", err.Error()) } @@ -236,8 +234,7 @@ func (client TagRulesClient) List(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("datadog.TagRulesClient", "List", err.Error()) } diff --git a/services/logz/mgmt/2020-10-01/logz/CHANGELOG.md b/services/logz/mgmt/2020-10-01/logz/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/logz/mgmt/2020-10-01/logz/CHANGELOG.md +++ b/services/logz/mgmt/2020-10-01/logz/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/logz/mgmt/2020-10-01/logz/_meta.json b/services/logz/mgmt/2020-10-01/logz/_meta.json index 169d79c63fb0..b340dfc66f0c 100644 --- a/services/logz/mgmt/2020-10-01/logz/_meta.json +++ b/services/logz/mgmt/2020-10-01/logz/_meta.json @@ -1,5 +1,5 @@ { - "commit": "daf57304e06ef0369f7d5d8104ae03ae78d13ca9", + "commit": "df2d8df906b4807729a88c44c6ece62925811b80", "readme": "/_/azure-rest-api-specs/specification/logz/resource-manager/readme.md", "tag": "package-2020-10-01", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/CHANGELOG.md b/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/CHANGELOG.md +++ b/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/_meta.json b/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/_meta.json index 99e8266bd4bb..74abb7520613 100644 --- a/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/_meta.json +++ b/services/preview/customproviders/mgmt/2018-09-01-preview/customproviders/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "df2d8df906b4807729a88c44c6ece62925811b80", "readme": "/_/azure-rest-api-specs/specification/customproviders/resource-manager/readme.md", "tag": "package-2018-09-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/CHANGELOG.md b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/CHANGELOG.md index 52911e4cc5e4..5cfa51cc2b00 100644 --- a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/CHANGELOG.md +++ b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/CHANGELOG.md @@ -1,2 +1,32 @@ -# Change History +# Unreleased +## Breaking Changes + +### Signature Changes + +#### Funcs + +1. MonitorsClient.Update + - Returns + - From: MonitorResource, error + - To: MonitorsUpdateFuture, error +1. MonitorsClient.UpdateSender + - Returns + - From: *http.Response, error + - To: MonitorsUpdateFuture, error + +## Additive Changes + +### New Funcs + +1. *MonitorsUpdateFuture.UnmarshalJSON([]byte) error + +### Struct Changes + +#### New Structs + +1. MonitorsUpdateFuture + +#### New Struct Fields + +1. MonitorResourceUpdateParameters.Sku diff --git a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/_meta.json b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/_meta.json index 6f23dd5e5784..1e07c0a1ac4d 100644 --- a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/_meta.json +++ b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/_meta.json @@ -1,5 +1,5 @@ { - "commit": "d9506558e6389e62926ae385f1d625a1376a0f9d", + "commit": "df2d8df906b4807729a88c44c6ece62925811b80", "readme": "/_/azure-rest-api-specs/specification/datadog/resource-manager/readme.md", "tag": "package-2020-02-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/datadogapi/interfaces.go b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/datadogapi/interfaces.go index 5c8f50571654..c3023d71f194 100644 --- a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/datadogapi/interfaces.go +++ b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/datadogapi/interfaces.go @@ -41,7 +41,7 @@ type MonitorsClientAPI interface { ListMonitoredResourcesComplete(ctx context.Context, resourceGroupName string, monitorName string) (result datadog.MonitoredResourceListResponseIterator, err error) RefreshSetPasswordLink(ctx context.Context, resourceGroupName string, monitorName string) (result datadog.SetPasswordLink, err error) SetDefaultKey(ctx context.Context, resourceGroupName string, monitorName string, body *datadog.APIKey) (result autorest.Response, err error) - Update(ctx context.Context, resourceGroupName string, monitorName string, body *datadog.MonitorResourceUpdateParameters) (result datadog.MonitorResource, err error) + Update(ctx context.Context, resourceGroupName string, monitorName string, body *datadog.MonitorResourceUpdateParameters) (result datadog.MonitorsUpdateFuture, err error) } var _ MonitorsClientAPI = (*datadog.MonitorsClient)(nil) diff --git a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/models.go b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/models.go index 05b765cad115..1679e1c81358 100644 --- a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/models.go +++ b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/models.go @@ -1412,6 +1412,7 @@ type MonitorResourceUpdateParameters struct { Properties *MonitorUpdateProperties `json:"properties,omitempty"` // Tags - The new tags of the monitor resource. Tags map[string]*string `json:"tags"` + Sku *ResourceSku `json:"sku,omitempty"` } // MarshalJSON is the custom marshaler for MonitorResourceUpdateParameters. @@ -1423,6 +1424,9 @@ func (mrup MonitorResourceUpdateParameters) MarshalJSON() ([]byte, error) { if mrup.Tags != nil { objectMap["tags"] = mrup.Tags } + if mrup.Sku != nil { + objectMap["sku"] = mrup.Sku + } return json.Marshal(objectMap) } @@ -1506,6 +1510,49 @@ func (future *MonitorsDeleteFuture) result(client MonitorsClient) (ar autorest.R return } +// MonitorsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitorsUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitorsClient) (MonitorResource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *MonitorsUpdateFuture) 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 MonitorsUpdateFuture.Result. +func (future *MonitorsUpdateFuture) result(client MonitorsClient) (mr MonitorResource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + mr.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("datadog.MonitorsUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mr.Response.Response, err = future.GetResult(sender); err == nil && mr.Response.Response.StatusCode != http.StatusNoContent { + mr, err = client.UpdateResponder(mr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "datadog.MonitorsUpdateFuture", "Result", mr.Response.Response, "Failure responding to request") + } + } + return +} + // MonitorUpdateProperties the set of properties that can be update in a PATCH request to a monitor // resource. type MonitorUpdateProperties struct { diff --git a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/monitors.go b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/monitors.go index 3cb4e1c9811c..76c0a45bb13c 100644 --- a/services/preview/datadog/mgmt/2020-02-01-preview/datadog/monitors.go +++ b/services/preview/datadog/mgmt/2020-02-01-preview/datadog/monitors.go @@ -1236,13 +1236,13 @@ func (client MonitorsClient) SetDefaultKeyResponder(resp *http.Response) (result // Parameters: // resourceGroupName - the name of the resource group to which the Datadog resource belongs. // monitorName - monitor resource name -func (client MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (result MonitorResource, err error) { +func (client MonitorsClient) Update(ctx context.Context, resourceGroupName string, monitorName string, body *MonitorResourceUpdateParameters) (result MonitorsUpdateFuture, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/MonitorsClient.Update") defer func() { sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode + if result.FutureAPI != nil && result.FutureAPI.Response() != nil { + sc = result.FutureAPI.Response().StatusCode } tracing.EndSpan(ctx, sc, err) }() @@ -1253,16 +1253,9 @@ func (client MonitorsClient) Update(ctx context.Context, resourceGroupName strin return } - resp, err := client.UpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Update", resp, "Failure sending request") - return - } - - result, err = client.UpdateResponder(resp) + result, err = client.UpdateSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "datadog.MonitorsClient", "Update", result.Response(), "Failure sending request") return } @@ -1297,8 +1290,18 @@ func (client MonitorsClient) UpdatePreparer(ctx context.Context, resourceGroupNa // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client MonitorsClient) UpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +func (client MonitorsClient) UpdateSender(req *http.Request) (future MonitorsUpdateFuture, 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 @@ -1306,7 +1309,7 @@ func (client MonitorsClient) UpdateSender(req *http.Request) (*http.Response, er func (client MonitorsClient) UpdateResponder(resp *http.Response) (result MonitorResource, err error) { err = autorest.Respond( resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), autorest.ByUnmarshallingJSON(&result), autorest.ByClosing()) result.Response = autorest.Response{Response: resp} diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md b/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md index 52911e4cc5e4..a1ecf841edb0 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/CHANGELOG.md @@ -1,2 +1,2 @@ -# Change History +# Unreleased diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json b/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json index 04805eb795ac..8e44faac51ab 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/_meta.json @@ -1,5 +1,5 @@ { - "commit": "394395ed0bdc1c5c05cb37a031379ca03bfebbb5", + "commit": "df2d8df906b4807729a88c44c6ece62925811b80", "readme": "/_/azure-rest-api-specs/specification/logz/resource-manager/readme.md", "tag": "package-2020-10-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go index 5e9cf8b4fcd2..1111bb48087e 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitor.go @@ -51,8 +51,7 @@ func (client MonitorClient) ListVMHosts(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("logz.MonitorClient", "ListVMHosts", err.Error()) } @@ -180,8 +179,7 @@ func (client MonitorClient) ListVMHostUpdate(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}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorClient", "ListVMHostUpdate", err.Error()) } @@ -313,8 +311,7 @@ func (client MonitorClient) VMHostPayload(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("logz.MonitorClient", "VMHostPayload", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go index da2020f57e69..ba62a41641d0 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/monitors.go @@ -51,8 +51,7 @@ func (client MonitorsClient) Create(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}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: false, @@ -173,8 +172,7 @@ func (client MonitorsClient) 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("logz.MonitorsClient", "Delete", err.Error()) } @@ -261,8 +259,7 @@ func (client MonitorsClient) 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("logz.MonitorsClient", "Get", err.Error()) } @@ -346,8 +343,7 @@ func (client MonitorsClient) ListByResourceGroup(ctx context.Context, resourceGr Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.MonitorsClient", "ListByResourceGroup", err.Error()) } @@ -592,8 +588,7 @@ func (client MonitorsClient) ListMonitoredResources(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("logz.MonitorsClient", "ListMonitoredResources", err.Error()) } @@ -720,8 +715,7 @@ func (client MonitorsClient) ListUserRoles(ctx context.Context, resourceGroupNam 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: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.EmailAddress", Name: validation.Null, Rule: false, @@ -858,8 +852,7 @@ func (client MonitorsClient) Update(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("logz.MonitorsClient", "Update", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go index f983a3ea9e36..90f57b7b4d19 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/singlesignon.go @@ -51,8 +51,7 @@ func (client SingleSignOnClient) CreateOrUpdate(ctx context.Context, resourceGro 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("logz.SingleSignOnClient", "CreateOrUpdate", err.Error()) } @@ -149,8 +148,7 @@ func (client SingleSignOnClient) Get(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("logz.SingleSignOnClient", "Get", err.Error()) } @@ -236,8 +234,7 @@ func (client SingleSignOnClient) List(ctx context.Context, resourceGroupName str Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SingleSignOnClient", "List", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go index 66243ed8eb2b..6f02cfef2e09 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccount.go @@ -52,8 +52,7 @@ func (client SubAccountClient) Create(ctx context.Context, resourceGroupName str Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: body, Constraints: []validation.Constraint{{Target: "body", Name: validation.Null, Rule: false, Chain: []validation.Constraint{{Target: "body.Properties", Name: validation.Null, Rule: false, @@ -176,8 +175,7 @@ func (client SubAccountClient) Delete(ctx context.Context, resourceGroupName str Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "Delete", err.Error()) } @@ -266,8 +264,7 @@ func (client SubAccountClient) 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("logz.SubAccountClient", "Get", err.Error()) } @@ -353,8 +350,7 @@ func (client SubAccountClient) List(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("logz.SubAccountClient", "List", err.Error()) } @@ -482,8 +478,7 @@ func (client SubAccountClient) ListMonitoredResources(ctx context.Context, resou 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("logz.SubAccountClient", "ListMonitoredResources", err.Error()) } @@ -612,8 +607,7 @@ func (client SubAccountClient) ListVMHosts(ctx context.Context, resourceGroupNam 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("logz.SubAccountClient", "ListVMHosts", err.Error()) } @@ -743,8 +737,7 @@ func (client SubAccountClient) ListVMHostUpdate(ctx context.Context, resourceGro 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("logz.SubAccountClient", "ListVMHostUpdate", err.Error()) } @@ -878,8 +871,7 @@ func (client SubAccountClient) Update(ctx context.Context, resourceGroupName str Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}, {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "Update", err.Error()) } @@ -971,8 +963,7 @@ func (client SubAccountClient) VMHostPayload(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}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("logz.SubAccountClient", "VMHostPayload", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go index 5e76443f5c7d..8ce469202f54 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/subaccounttagrules.go @@ -53,8 +53,7 @@ func (client SubAccountTagRulesClient) CreateOrUpdate(ctx context.Context, resou 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("logz.SubAccountTagRulesClient", "CreateOrUpdate", err.Error()) } @@ -151,8 +150,7 @@ func (client SubAccountTagRulesClient) Delete(ctx context.Context, resourceGroup 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("logz.SubAccountTagRulesClient", "Delete", err.Error()) } @@ -239,8 +237,7 @@ func (client SubAccountTagRulesClient) Get(ctx context.Context, resourceGroupNam 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("logz.SubAccountTagRulesClient", "Get", err.Error()) } @@ -328,8 +325,7 @@ func (client SubAccountTagRulesClient) List(ctx context.Context, resourceGroupNa 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("logz.SubAccountTagRulesClient", "List", err.Error()) } diff --git a/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go b/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go index 3557d41088cd..5bf2cec94ec2 100644 --- a/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go +++ b/services/preview/logz/mgmt/2020-10-01-preview/logz/tagrules.go @@ -51,8 +51,7 @@ func (client TagRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupNa 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("logz.TagRulesClient", "CreateOrUpdate", err.Error()) } @@ -147,8 +146,7 @@ func (client TagRulesClient) 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("logz.TagRulesClient", "Delete", err.Error()) } @@ -233,8 +231,7 @@ func (client TagRulesClient) 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("logz.TagRulesClient", "Get", err.Error()) } @@ -320,8 +317,7 @@ func (client TagRulesClient) List(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("logz.TagRulesClient", "List", err.Error()) } diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/CHANGELOG.md b/services/preview/saas/mgmt/2018-03-01-preview/saas/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/_meta.json b/services/preview/saas/mgmt/2018-03-01-preview/saas/_meta.json new file mode 100644 index 000000000000..2ae67dcd29b0 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "df2d8df906b4807729a88c44c6ece62925811b80", + "readme": "/_/azure-rest-api-specs/specification/saas/resource-manager/readme.md", + "tag": "package-2018-03-01-beta", + "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-2018-03-01-beta --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/azure-rest-api-specs/specification/saas/resource-manager/readme.md", + "additional_properties": { + "additional_options": "--go --verbose --use-onever --version=V2 --go.license-header=MICROSOFT_MIT_NO_VERSION" + } +} \ No newline at end of file diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/applications.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/applications.go new file mode 100644 index 000000000000..4561418467b1 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/applications.go @@ -0,0 +1,147 @@ +package saas + +// 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" +) + +// ApplicationsClient is the REST APIs for Azure Marketplace SaaS Offers +type ApplicationsClient struct { + BaseClient +} + +// NewApplicationsClient creates an instance of the ApplicationsClient client. +func NewApplicationsClient(subscriptionID string) ApplicationsClient { + return NewApplicationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewApplicationsClientWithBaseURI creates an instance of the ApplicationsClient 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 NewApplicationsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationsClient { + return ApplicationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List gets all SaaS resources by subscription id and resource group name. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client ApplicationsClient) List(ctx context.Context, resourceGroupName string) (result AppResponseWithContinuationPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.List") + defer func() { + sc := -1 + if result.arwc.Response.Response != nil { + sc = result.arwc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.ApplicationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.arwc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.ApplicationsClient", "List", resp, "Failure sending request") + return + } + + result.arwc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.ApplicationsClient", "List", resp, "Failure responding to request") + return + } + if result.arwc.hasNextLink() && result.arwc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ApplicationsClient) ListPreparer(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-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/applications", 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 ApplicationsClient) 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 ApplicationsClient) ListResponder(resp *http.Response) (result AppResponseWithContinuation, 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 ApplicationsClient) listNextResults(ctx context.Context, lastResults AppResponseWithContinuation) (result AppResponseWithContinuation, err error) { + req, err := lastResults.appResponseWithContinuationPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "saas.ApplicationsClient", "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, "saas.ApplicationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.ApplicationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ApplicationsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AppResponseWithContinuationIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationsClient.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) + return +} diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/client.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/client.go new file mode 100644 index 000000000000..c822cf7c21d6 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/client.go @@ -0,0 +1,119 @@ +// Package saas implements the Azure ARM Saas service API version 2018-03-01-beta. +// +// REST APIs for Azure Marketplace SaaS Offers +package saas + +// 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" +) + +const ( + // DefaultBaseURI is the default URI used for the service Saas + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Saas. +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, + } +} + +// ResourceListAccessToken gets the ISV access token for a SaaS resource. +// Parameters: +// resourceID - the Saas resource ID. This is a GUID-formatted string (e.g. +// 00000000-0000-0000-0000-000000000000) +func (client BaseClient) ResourceListAccessToken(ctx context.Context, resourceID string) (result AccessTokenResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.ResourceListAccessToken") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ResourceListAccessTokenPreparer(ctx, resourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.BaseClient", "ResourceListAccessToken", nil, "Failure preparing request") + return + } + + resp, err := client.ResourceListAccessTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.BaseClient", "ResourceListAccessToken", resp, "Failure sending request") + return + } + + result, err = client.ResourceListAccessTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.BaseClient", "ResourceListAccessToken", resp, "Failure responding to request") + return + } + + return +} + +// ResourceListAccessTokenPreparer prepares the ResourceListAccessToken request. +func (client BaseClient) ResourceListAccessTokenPreparer(ctx context.Context, resourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.SaaS/saasresources/{resourceId}/listAccessToken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ResourceListAccessTokenSender sends the ResourceListAccessToken request. The method will close the +// http.Response Body if it receives an error. +func (client BaseClient) ResourceListAccessTokenSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ResourceListAccessTokenResponder handles the response to the ResourceListAccessToken request. The method always +// closes the http.Response Body. +func (client BaseClient) ResourceListAccessTokenResponder(resp *http.Response) (result AccessTokenResult, 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/saas/mgmt/2018-03-01-preview/saas/enums.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/enums.go new file mode 100644 index 000000000000..0ec314f31cf6 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/enums.go @@ -0,0 +1,64 @@ +package saas + +// 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. + +// AppStatus enumerates the values for app status. +type AppStatus string + +const ( + // Deactivated ... + Deactivated AppStatus = "Deactivated" + // Pending ... + Pending AppStatus = "Pending" + // Subscribed ... + Subscribed AppStatus = "Subscribed" + // Suspended ... + Suspended AppStatus = "Suspended" + // Unsubscribed ... + Unsubscribed AppStatus = "Unsubscribed" +) + +// PossibleAppStatusValues returns an array of possible values for the AppStatus const type. +func PossibleAppStatusValues() []AppStatus { + return []AppStatus{Deactivated, Pending, Subscribed, Suspended, Unsubscribed} +} + +// PaymentChannelType enumerates the values for payment channel type. +type PaymentChannelType string + +const ( + // CustomerDelegated ... + CustomerDelegated PaymentChannelType = "CustomerDelegated" + // SubscriptionDelegated ... + SubscriptionDelegated PaymentChannelType = "SubscriptionDelegated" +) + +// PossiblePaymentChannelTypeValues returns an array of possible values for the PaymentChannelType const type. +func PossiblePaymentChannelTypeValues() []PaymentChannelType { + return []PaymentChannelType{CustomerDelegated, SubscriptionDelegated} +} + +// ResourceStatus enumerates the values for resource status. +type ResourceStatus string + +const ( + // ResourceStatusNotStarted ... + ResourceStatusNotStarted ResourceStatus = "NotStarted" + // ResourceStatusPendingFulfillmentStart ... + ResourceStatusPendingFulfillmentStart ResourceStatus = "PendingFulfillmentStart" + // ResourceStatusSubscribed ... + ResourceStatusSubscribed ResourceStatus = "Subscribed" + // ResourceStatusSuspended ... + ResourceStatusSuspended ResourceStatus = "Suspended" + // ResourceStatusUnsubscribed ... + ResourceStatusUnsubscribed ResourceStatus = "Unsubscribed" +) + +// PossibleResourceStatusValues returns an array of possible values for the ResourceStatus const type. +func PossibleResourceStatusValues() []ResourceStatus { + return []ResourceStatus{ResourceStatusNotStarted, ResourceStatusPendingFulfillmentStart, ResourceStatusSubscribed, ResourceStatusSuspended, ResourceStatusUnsubscribed} +} diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/models.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/models.go new file mode 100644 index 000000000000..894226ae1ce2 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/models.go @@ -0,0 +1,1277 @@ +package saas + +// 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/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/saas/mgmt/2018-03-01-preview/saas" + +// AccessTokenResult the ISV access token result response. +type AccessTokenResult struct { + autorest.Response `json:"-"` + // PublisherOfferBaseURI - The Publisher Offer Base Uri + PublisherOfferBaseURI *string `json:"publisherOfferBaseUri,omitempty"` + // Token - The generated token + Token *string `json:"token,omitempty"` +} + +// App the saasApp resource. +type App struct { + // ID - READ-ONLY; the resource Id. + ID *string `json:"id,omitempty"` + // Location - the resource location. + Location *string `json:"location,omitempty"` + // Name - the resource name. + Name *string `json:"name,omitempty"` + // Type - the resource type. + Type *string `json:"type,omitempty"` + // Properties - the resource properties. + Properties *AppProperties `json:"properties,omitempty"` + // Tags - the resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for App. +func (a App) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.Location != nil { + objectMap["location"] = a.Location + } + if a.Name != nil { + objectMap["name"] = a.Name + } + if a.Type != nil { + objectMap["type"] = a.Type + } + if a.Properties != nil { + objectMap["properties"] = a.Properties + } + if a.Tags != nil { + objectMap["tags"] = a.Tags + } + return json.Marshal(objectMap) +} + +// AppOperation saas app operations +type AppOperation struct { + // Name - the operation name + Name *string `json:"name,omitempty"` + // Display - the operation display + Display *AppOperationDisplay `json:"display,omitempty"` + // Origin - the operation origin + Origin *string `json:"origin,omitempty"` + // IsDataAction - whether the operation is a data action or not. + IsDataAction *bool `json:"isDataAction,omitempty"` +} + +// AppOperationDisplay saas app operation display +type AppOperationDisplay struct { + // Provider - Name of the provider for display purposes + Provider *string `json:"provider,omitempty"` + // Resource - Name of the resource type for display purposes + Resource *string `json:"resource,omitempty"` + // Operation - Name of the operation for display purposes + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation for display purposes + Description *string `json:"description,omitempty"` +} + +// AppOperationsResponseWithContinuation saas app operation response with continuation. +type AppOperationsResponseWithContinuation struct { + autorest.Response `json:"-"` + // NextLink - the next link to query to get the remaining results. + NextLink *string `json:"nextLink,omitempty"` + // Value - the value of response. + Value *[]AppOperation `json:"value,omitempty"` +} + +// AppOperationsResponseWithContinuationIterator provides access to a complete listing of AppOperation +// values. +type AppOperationsResponseWithContinuationIterator struct { + i int + page AppOperationsResponseWithContinuationPage +} + +// 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 *AppOperationsResponseWithContinuationIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppOperationsResponseWithContinuationIterator.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 *AppOperationsResponseWithContinuationIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppOperationsResponseWithContinuationIterator) 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 AppOperationsResponseWithContinuationIterator) Response() AppOperationsResponseWithContinuation { + 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 AppOperationsResponseWithContinuationIterator) Value() AppOperation { + if !iter.page.NotDone() { + return AppOperation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppOperationsResponseWithContinuationIterator type. +func NewAppOperationsResponseWithContinuationIterator(page AppOperationsResponseWithContinuationPage) AppOperationsResponseWithContinuationIterator { + return AppOperationsResponseWithContinuationIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (aorwc AppOperationsResponseWithContinuation) IsEmpty() bool { + return aorwc.Value == nil || len(*aorwc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (aorwc AppOperationsResponseWithContinuation) hasNextLink() bool { + return aorwc.NextLink != nil && len(*aorwc.NextLink) != 0 +} + +// appOperationsResponseWithContinuationPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (aorwc AppOperationsResponseWithContinuation) appOperationsResponseWithContinuationPreparer(ctx context.Context) (*http.Request, error) { + if !aorwc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(aorwc.NextLink))) +} + +// AppOperationsResponseWithContinuationPage contains a page of AppOperation values. +type AppOperationsResponseWithContinuationPage struct { + fn func(context.Context, AppOperationsResponseWithContinuation) (AppOperationsResponseWithContinuation, error) + aorwc AppOperationsResponseWithContinuation +} + +// 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 *AppOperationsResponseWithContinuationPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppOperationsResponseWithContinuationPage.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.aorwc) + if err != nil { + return err + } + page.aorwc = 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 *AppOperationsResponseWithContinuationPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppOperationsResponseWithContinuationPage) NotDone() bool { + return !page.aorwc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppOperationsResponseWithContinuationPage) Response() AppOperationsResponseWithContinuation { + return page.aorwc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppOperationsResponseWithContinuationPage) Values() []AppOperation { + if page.aorwc.IsEmpty() { + return nil + } + return *page.aorwc.Value +} + +// Creates a new instance of the AppOperationsResponseWithContinuationPage type. +func NewAppOperationsResponseWithContinuationPage(cur AppOperationsResponseWithContinuation, getNextPage func(context.Context, AppOperationsResponseWithContinuation) (AppOperationsResponseWithContinuation, error)) AppOperationsResponseWithContinuationPage { + return AppOperationsResponseWithContinuationPage{ + fn: getNextPage, + aorwc: cur, + } +} + +// AppPlan saas resource plan. +type AppPlan struct { + // Publisher - the publisher id. + Publisher *string `json:"publisher,omitempty"` + // Product - the offer id. + Product *string `json:"product,omitempty"` + // Name - the plan id. + Name *string `json:"name,omitempty"` +} + +// AppProperties saas resource properties. +type AppProperties struct { + // Status - the Saas resource status. Possible values include: 'Pending', 'Subscribed', 'Unsubscribed', 'Suspended', 'Deactivated' + Status AppStatus `json:"status,omitempty"` + // SaasAppPlan - the resource plan details. + SaasAppPlan *AppPlan `json:"saasAppPlan,omitempty"` +} + +// AppResponseWithContinuation saas app response with continuation. +type AppResponseWithContinuation struct { + autorest.Response `json:"-"` + // NextLink - the next link to query to get the remaining results. + NextLink *string `json:"nextLink,omitempty"` + // Value - the value of response. + Value *[]App `json:"value,omitempty"` +} + +// AppResponseWithContinuationIterator provides access to a complete listing of App values. +type AppResponseWithContinuationIterator struct { + i int + page AppResponseWithContinuationPage +} + +// 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 *AppResponseWithContinuationIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResponseWithContinuationIterator.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 *AppResponseWithContinuationIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AppResponseWithContinuationIterator) 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 AppResponseWithContinuationIterator) Response() AppResponseWithContinuation { + 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 AppResponseWithContinuationIterator) Value() App { + if !iter.page.NotDone() { + return App{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AppResponseWithContinuationIterator type. +func NewAppResponseWithContinuationIterator(page AppResponseWithContinuationPage) AppResponseWithContinuationIterator { + return AppResponseWithContinuationIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (arwc AppResponseWithContinuation) IsEmpty() bool { + return arwc.Value == nil || len(*arwc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (arwc AppResponseWithContinuation) hasNextLink() bool { + return arwc.NextLink != nil && len(*arwc.NextLink) != 0 +} + +// appResponseWithContinuationPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (arwc AppResponseWithContinuation) appResponseWithContinuationPreparer(ctx context.Context) (*http.Request, error) { + if !arwc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(arwc.NextLink))) +} + +// AppResponseWithContinuationPage contains a page of App values. +type AppResponseWithContinuationPage struct { + fn func(context.Context, AppResponseWithContinuation) (AppResponseWithContinuation, error) + arwc AppResponseWithContinuation +} + +// 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 *AppResponseWithContinuationPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AppResponseWithContinuationPage.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.arwc) + if err != nil { + return err + } + page.arwc = 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 *AppResponseWithContinuationPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AppResponseWithContinuationPage) NotDone() bool { + return !page.arwc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AppResponseWithContinuationPage) Response() AppResponseWithContinuation { + return page.arwc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AppResponseWithContinuationPage) Values() []App { + if page.arwc.IsEmpty() { + return nil + } + return *page.arwc.Value +} + +// Creates a new instance of the AppResponseWithContinuationPage type. +func NewAppResponseWithContinuationPage(cur AppResponseWithContinuation, getNextPage func(context.Context, AppResponseWithContinuation) (AppResponseWithContinuation, error)) AppResponseWithContinuationPage { + return AppResponseWithContinuationPage{ + fn: getNextPage, + arwc: cur, + } +} + +// CreateResourceFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type CreateResourceFuture 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) (Resource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *CreateResourceFuture) 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 CreateResourceFuture.Result. +func (future *CreateResourceFuture) result(client Client) (r Resource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.CreateResourceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.CreateResourceFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateResourceResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.CreateResourceFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// CreationProperties properties for creation saas +type CreationProperties struct { + // OfferID - The offer id. + OfferID *string `json:"offerId,omitempty"` + // PublisherID - The publisher id. + PublisherID *string `json:"publisherId,omitempty"` + // Quantity - The seat count. + Quantity *float64 `json:"quantity,omitempty"` + // SkuID - The plan id. + SkuID *string `json:"skuId,omitempty"` + // PaymentChannelType - The Payment channel for the SaasSubscription. Possible values include: 'SubscriptionDelegated', 'CustomerDelegated' + PaymentChannelType PaymentChannelType `json:"paymentChannelType,omitempty"` + // PaymentChannelMetadata - The metadata about the SaaS subscription such as the AzureSubscriptionId and ResourceUri. + PaymentChannelMetadata map[string]*string `json:"paymentChannelMetadata"` + // SaasResourceName - The SaaS resource name. + SaasResourceName *string `json:"saasResourceName,omitempty"` + // TermID - The current Term id. + TermID *string `json:"termId,omitempty"` + // AutoRenew - Whether the SaaS subscription will auto renew upon term end. + AutoRenew *bool `json:"autoRenew,omitempty"` + // PublisherTestEnvironment - The environment in the publisher side for this resource. + PublisherTestEnvironment *string `json:"publisherTestEnvironment,omitempty"` + // SaasSubscriptionID - The saas subscription id used for tenant to subscription level migration request. + SaasSubscriptionID *string `json:"saasSubscriptionId,omitempty"` + // SaasSessionID - The saas session id used for dev service migration request. + SaasSessionID *string `json:"saasSessionId,omitempty"` +} + +// MarshalJSON is the custom marshaler for CreationProperties. +func (cp CreationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.OfferID != nil { + objectMap["offerId"] = cp.OfferID + } + if cp.PublisherID != nil { + objectMap["publisherId"] = cp.PublisherID + } + if cp.Quantity != nil { + objectMap["quantity"] = cp.Quantity + } + if cp.SkuID != nil { + objectMap["skuId"] = cp.SkuID + } + if cp.PaymentChannelType != "" { + objectMap["paymentChannelType"] = cp.PaymentChannelType + } + if cp.PaymentChannelMetadata != nil { + objectMap["paymentChannelMetadata"] = cp.PaymentChannelMetadata + } + if cp.SaasResourceName != nil { + objectMap["saasResourceName"] = cp.SaasResourceName + } + if cp.TermID != nil { + objectMap["termId"] = cp.TermID + } + if cp.AutoRenew != nil { + objectMap["autoRenew"] = cp.AutoRenew + } + if cp.PublisherTestEnvironment != nil { + objectMap["publisherTestEnvironment"] = cp.PublisherTestEnvironment + } + if cp.SaasSubscriptionID != nil { + objectMap["saasSubscriptionId"] = cp.SaasSubscriptionID + } + if cp.SaasSessionID != nil { + objectMap["saasSessionId"] = cp.SaasSessionID + } + return json.Marshal(objectMap) +} + +// 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) (autorest.Response, 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) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.DeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.DeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DeleteOptions delete Options +type DeleteOptions struct { + // UnsubscribeOnly - whether it is unsubscribeOnly + UnsubscribeOnly *bool `json:"unsubscribeOnly,omitempty"` + // ReasonCode - The reasonCode + ReasonCode *float64 `json:"reasonCode,omitempty"` + // Feedback - the feedback + Feedback *string `json:"feedback,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"` +} + +// MoveResource resource Move Options +type MoveResource struct { + // TargetResourceGroup - The target resource group uri for the move + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + // Resources - The resource uris to move + Resources *[]string `json:"resources,omitempty"` +} + +// OperationGetFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type OperationGetFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OperationClient) (Resource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *OperationGetFuture) 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 OperationGetFuture.Result. +func (future *OperationGetFuture) result(client OperationClient) (r Resource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.OperationGetFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.OperationGetFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.GetResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.OperationGetFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// Properties saas resource properties +type Properties struct { + // Status - The SaaS Subscription Status. Possible values include: 'ResourceStatusNotStarted', 'ResourceStatusPendingFulfillmentStart', 'ResourceStatusSubscribed', 'ResourceStatusUnsubscribed', 'ResourceStatusSuspended' + Status ResourceStatus `json:"status,omitempty"` + // Term - The current Term object. + Term *ResourcePropertiesTerm `json:"term,omitempty"` + // IsFreeTrial - Whether the current term is a Free Trial term + IsFreeTrial *bool `json:"isFreeTrial,omitempty"` + // Created - READ-ONLY; The created date of this resource. + Created *string `json:"created,omitempty"` + // LastModified - The last modifier date if this resource. + LastModified *string `json:"lastModified,omitempty"` +} + +// MarshalJSON is the custom marshaler for Properties. +func (p Properties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if p.Status != "" { + objectMap["status"] = p.Status + } + if p.Term != nil { + objectMap["term"] = p.Term + } + if p.IsFreeTrial != nil { + objectMap["isFreeTrial"] = p.IsFreeTrial + } + if p.LastModified != nil { + objectMap["lastModified"] = p.LastModified + } + return json.Marshal(objectMap) +} + +// Resource saaS REST API resource definition. +type Resource struct { + autorest.Response `json:"-"` + // Properties - saas properties + Properties *ResourceProperties `json:"properties,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // ID - READ-ONLY; The resource uri + ID *string `json:"id,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - the resource tags. + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Properties != nil { + objectMap["properties"] = r.Properties + } + if r.Tags != nil { + objectMap["tags"] = r.Tags + } + return json.Marshal(objectMap) +} + +// ResourceCreation saaS REST API resource definition for creation. +type ResourceCreation struct { + // ID - READ-ONLY; The resource uri + ID *string `json:"id,omitempty"` + // Name - The resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type. + Type *string `json:"type,omitempty"` + // Tags - the resource tags. + Tags map[string]*string `json:"tags"` + // Location - Resource location. Only value allowed for SaaS is 'global' + Location *string `json:"location,omitempty"` + // Properties - Properties of the SaaS resource that are relevant for creation. + Properties *CreationProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceCreation. +func (rc ResourceCreation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if rc.Name != nil { + objectMap["name"] = rc.Name + } + if rc.Tags != nil { + objectMap["tags"] = rc.Tags + } + if rc.Location != nil { + objectMap["location"] = rc.Location + } + if rc.Properties != nil { + objectMap["properties"] = rc.Properties + } + return json.Marshal(objectMap) +} + +// ResourceProperties saas properties +type ResourceProperties struct { + // Status - The SaaS Subscription Status. Possible values include: 'ResourceStatusNotStarted', 'ResourceStatusPendingFulfillmentStart', 'ResourceStatusSubscribed', 'ResourceStatusUnsubscribed', 'ResourceStatusSuspended' + Status ResourceStatus `json:"status,omitempty"` + // Term - The current Term object. + Term *ResourcePropertiesTerm `json:"term,omitempty"` + // IsFreeTrial - Whether the current term is a Free Trial term + IsFreeTrial *bool `json:"isFreeTrial,omitempty"` + // Created - READ-ONLY; The created date of this resource. + Created *string `json:"created,omitempty"` + // LastModified - The last modifier date if this resource. + LastModified *string `json:"lastModified,omitempty"` + // OfferID - The offer id. + OfferID *string `json:"offerId,omitempty"` + // PublisherID - The publisher id. + PublisherID *string `json:"publisherId,omitempty"` + // Quantity - The seat count. + Quantity *float64 `json:"quantity,omitempty"` + // SkuID - The plan id. + SkuID *string `json:"skuId,omitempty"` + // PaymentChannelType - The Payment channel for the SaasSubscription. Possible values include: 'SubscriptionDelegated', 'CustomerDelegated' + PaymentChannelType PaymentChannelType `json:"paymentChannelType,omitempty"` + // PaymentChannelMetadata - The metadata about the SaaS subscription such as the AzureSubscriptionId and ResourceUri. + PaymentChannelMetadata map[string]*string `json:"paymentChannelMetadata"` + // SaasResourceName - The SaaS resource name. + SaasResourceName *string `json:"saasResourceName,omitempty"` + // TermID - The current Term id. + TermID *string `json:"termId,omitempty"` + // AutoRenew - Whether the SaaS subscription will auto renew upon term end. + AutoRenew *bool `json:"autoRenew,omitempty"` + // PublisherTestEnvironment - The environment in the publisher side for this resource. + PublisherTestEnvironment *string `json:"publisherTestEnvironment,omitempty"` + // SaasSubscriptionID - The saas subscription id used for tenant to subscription level migration request. + SaasSubscriptionID *string `json:"saasSubscriptionId,omitempty"` + // SaasSessionID - The saas session id used for dev service migration request. + SaasSessionID *string `json:"saasSessionId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceProperties. +func (r ResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if r.Status != "" { + objectMap["status"] = r.Status + } + if r.Term != nil { + objectMap["term"] = r.Term + } + if r.IsFreeTrial != nil { + objectMap["isFreeTrial"] = r.IsFreeTrial + } + if r.LastModified != nil { + objectMap["lastModified"] = r.LastModified + } + if r.OfferID != nil { + objectMap["offerId"] = r.OfferID + } + if r.PublisherID != nil { + objectMap["publisherId"] = r.PublisherID + } + if r.Quantity != nil { + objectMap["quantity"] = r.Quantity + } + if r.SkuID != nil { + objectMap["skuId"] = r.SkuID + } + if r.PaymentChannelType != "" { + objectMap["paymentChannelType"] = r.PaymentChannelType + } + if r.PaymentChannelMetadata != nil { + objectMap["paymentChannelMetadata"] = r.PaymentChannelMetadata + } + if r.SaasResourceName != nil { + objectMap["saasResourceName"] = r.SaasResourceName + } + if r.TermID != nil { + objectMap["termId"] = r.TermID + } + if r.AutoRenew != nil { + objectMap["autoRenew"] = r.AutoRenew + } + if r.PublisherTestEnvironment != nil { + objectMap["publisherTestEnvironment"] = r.PublisherTestEnvironment + } + if r.SaasSubscriptionID != nil { + objectMap["saasSubscriptionId"] = r.SaasSubscriptionID + } + if r.SaasSessionID != nil { + objectMap["saasSessionId"] = r.SaasSessionID + } + return json.Marshal(objectMap) +} + +// ResourcePropertiesTerm the current Term object. +type ResourcePropertiesTerm struct { + // TermUnit - The unit indicating Monthly / Yearly + TermUnit *string `json:"termUnit,omitempty"` + // StartDate - The start date of the current term + StartDate *string `json:"startDate,omitempty"` + // EndDate - The end date of the current term + EndDate *string `json:"endDate,omitempty"` +} + +// ResourceResponseWithContinuation saas resources response with continuation. +type ResourceResponseWithContinuation struct { + autorest.Response `json:"-"` + // NextLink - the next link to query to get the remaining results. + NextLink *string `json:"nextLink,omitempty"` + // Value - the value of response. + Value *[]Resource `json:"value,omitempty"` +} + +// ResourceResponseWithContinuationIterator provides access to a complete listing of Resource values. +type ResourceResponseWithContinuationIterator struct { + i int + page ResourceResponseWithContinuationPage +} + +// 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 *ResourceResponseWithContinuationIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceResponseWithContinuationIterator.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 *ResourceResponseWithContinuationIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ResourceResponseWithContinuationIterator) 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 ResourceResponseWithContinuationIterator) Response() ResourceResponseWithContinuation { + 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 ResourceResponseWithContinuationIterator) Value() Resource { + if !iter.page.NotDone() { + return Resource{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ResourceResponseWithContinuationIterator type. +func NewResourceResponseWithContinuationIterator(page ResourceResponseWithContinuationPage) ResourceResponseWithContinuationIterator { + return ResourceResponseWithContinuationIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rrwc ResourceResponseWithContinuation) IsEmpty() bool { + return rrwc.Value == nil || len(*rrwc.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rrwc ResourceResponseWithContinuation) hasNextLink() bool { + return rrwc.NextLink != nil && len(*rrwc.NextLink) != 0 +} + +// resourceResponseWithContinuationPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rrwc ResourceResponseWithContinuation) resourceResponseWithContinuationPreparer(ctx context.Context) (*http.Request, error) { + if !rrwc.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rrwc.NextLink))) +} + +// ResourceResponseWithContinuationPage contains a page of Resource values. +type ResourceResponseWithContinuationPage struct { + fn func(context.Context, ResourceResponseWithContinuation) (ResourceResponseWithContinuation, error) + rrwc ResourceResponseWithContinuation +} + +// 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 *ResourceResponseWithContinuationPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourceResponseWithContinuationPage.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.rrwc) + if err != nil { + return err + } + page.rrwc = 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 *ResourceResponseWithContinuationPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ResourceResponseWithContinuationPage) NotDone() bool { + return !page.rrwc.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ResourceResponseWithContinuationPage) Response() ResourceResponseWithContinuation { + return page.rrwc +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ResourceResponseWithContinuationPage) Values() []Resource { + if page.rrwc.IsEmpty() { + return nil + } + return *page.rrwc.Value +} + +// Creates a new instance of the ResourceResponseWithContinuationPage type. +func NewResourceResponseWithContinuationPage(cur ResourceResponseWithContinuation, getNextPage func(context.Context, ResourceResponseWithContinuation) (ResourceResponseWithContinuation, error)) ResourceResponseWithContinuationPage { + return ResourceResponseWithContinuationPage{ + fn: getNextPage, + rrwc: cur, + } +} + +// Result sample result definition +type Result struct { + // SampleProperty - Sample property of type string + SampleProperty *string `json:"sampleProperty,omitempty"` +} + +// SubscriptionLevelCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SubscriptionLevelCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubscriptionLevelClient) (Resource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubscriptionLevelCreateOrUpdateFuture) 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 SubscriptionLevelCreateOrUpdateFuture.Result. +func (future *SubscriptionLevelCreateOrUpdateFuture) result(client SubscriptionLevelClient) (r Resource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.SubscriptionLevelCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.CreateOrUpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelCreateOrUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// SubscriptionLevelDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubscriptionLevelDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubscriptionLevelClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubscriptionLevelDeleteFuture) 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 SubscriptionLevelDeleteFuture.Result. +func (future *SubscriptionLevelDeleteFuture) result(client SubscriptionLevelClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.SubscriptionLevelDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// SubscriptionLevelMoveResourcesFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type SubscriptionLevelMoveResourcesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubscriptionLevelClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubscriptionLevelMoveResourcesFuture) 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 SubscriptionLevelMoveResourcesFuture.Result. +func (future *SubscriptionLevelMoveResourcesFuture) result(client SubscriptionLevelClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelMoveResourcesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.SubscriptionLevelMoveResourcesFuture") + return + } + ar.Response = future.Response() + return +} + +// SubscriptionLevelUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubscriptionLevelUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubscriptionLevelClient) (Resource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubscriptionLevelUpdateFuture) 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 SubscriptionLevelUpdateFuture.Result. +func (future *SubscriptionLevelUpdateFuture) result(client SubscriptionLevelClient) (r Resource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.SubscriptionLevelUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelUpdateFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} + +// SubscriptionLevelUpdateToUnsubscribedFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type SubscriptionLevelUpdateToUnsubscribedFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SubscriptionLevelClient) (autorest.Response, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *SubscriptionLevelUpdateToUnsubscribedFuture) 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 SubscriptionLevelUpdateToUnsubscribedFuture.Result. +func (future *SubscriptionLevelUpdateToUnsubscribedFuture) result(client SubscriptionLevelClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelUpdateToUnsubscribedFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + ar.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.SubscriptionLevelUpdateToUnsubscribedFuture") + return + } + ar.Response = future.Response() + return +} + +// UpdateResourceFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type UpdateResourceFuture 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) (Resource, error) +} + +// UnmarshalJSON is the custom unmarshaller for CreateFuture. +func (future *UpdateResourceFuture) 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 UpdateResourceFuture.Result. +func (future *UpdateResourceFuture) result(client Client) (r Resource, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.UpdateResourceFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + r.Response.Response = future.Response() + err = azure.NewAsyncOpIncompleteError("saas.UpdateResourceFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if r.Response.Response, err = future.GetResult(sender); err == nil && r.Response.Response.StatusCode != http.StatusNoContent { + r, err = client.UpdateResourceResponder(r.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.UpdateResourceFuture", "Result", r.Response.Response, "Failure responding to request") + } + } + return +} diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/operation.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/operation.go new file mode 100644 index 000000000000..2d993f05a5a9 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/operation.go @@ -0,0 +1,107 @@ +package saas + +// 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" +) + +// OperationClient is the REST APIs for Azure Marketplace SaaS Offers +type OperationClient struct { + BaseClient +} + +// NewOperationClient creates an instance of the OperationClient client. +func NewOperationClient(subscriptionID string) OperationClient { + return NewOperationClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationClientWithBaseURI creates an instance of the OperationClient 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 NewOperationClientWithBaseURI(baseURI string, subscriptionID string) OperationClient { + return OperationClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get gets information about the specified operation progress. +// Parameters: +// operationID - the operation Id parameter. +func (client OperationClient) Get(ctx context.Context, operationID string) (result OperationGetFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationClient.Get") + 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.GetPreparer(ctx, operationID) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.OperationClient", "Get", nil, "Failure preparing request") + return + } + + result, err = client.GetSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.OperationClient", "Get", result.Response(), "Failure sending request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationClient) GetPreparer(ctx context.Context, operationID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "operationId": autorest.Encode("path", operationID), + } + + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.SaaS/operationResults/{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 OperationClient) GetSender(req *http.Request) (future OperationGetFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client OperationClient) GetResponder(resp *http.Response) (result Resource, 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/saas/mgmt/2018-03-01-preview/saas/operations.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/operations.go new file mode 100644 index 000000000000..003760e15ba3 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/operations.go @@ -0,0 +1,140 @@ +package saas + +// 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 REST APIs for Azure Marketplace SaaS Offers +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 gets all SaaS app operations. +func (client OperationsClient) List(ctx context.Context) (result AppOperationsResponseWithContinuationPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.aorwc.Response.Response != nil { + sc = result.aorwc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.aorwc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.aorwc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.aorwc.hasNextLink() && result.aorwc.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-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.SaaS/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 AppOperationsResponseWithContinuation, 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 AppOperationsResponseWithContinuation) (result AppOperationsResponseWithContinuation, err error) { + req, err := lastResults.appOperationsResponseWithContinuationPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "saas.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, "saas.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.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 AppOperationsResponseWithContinuationIterator, 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/saas/mgmt/2018-03-01-preview/saas/resources.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/resources.go new file mode 100644 index 000000000000..b7b393bbb7f5 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/resources.go @@ -0,0 +1,140 @@ +package saas + +// 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" +) + +// ResourcesClient is the REST APIs for Azure Marketplace SaaS Offers +type ResourcesClient struct { + BaseClient +} + +// NewResourcesClient creates an instance of the ResourcesClient client. +func NewResourcesClient(subscriptionID string) ResourcesClient { + return NewResourcesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewResourcesClientWithBaseURI creates an instance of the ResourcesClient 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 NewResourcesClientWithBaseURI(baseURI string, subscriptionID string) ResourcesClient { + return ResourcesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List get All Resources +func (client ResourcesClient) List(ctx context.Context) (result ResourceResponseWithContinuationPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcesClient.List") + defer func() { + sc := -1 + if result.rrwc.Response.Response != nil { + sc = result.rrwc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.ResourcesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.rrwc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.ResourcesClient", "List", resp, "Failure sending request") + return + } + + result.rrwc, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.ResourcesClient", "List", resp, "Failure responding to request") + return + } + if result.rrwc.hasNextLink() && result.rrwc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client ResourcesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.SaaS/saasresources"), + 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 ResourcesClient) 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 ResourcesClient) ListResponder(resp *http.Response) (result ResourceResponseWithContinuation, 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 ResourcesClient) listNextResults(ctx context.Context, lastResults ResourceResponseWithContinuation) (result ResourceResponseWithContinuation, err error) { + req, err := lastResults.resourceResponseWithContinuationPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "saas.ResourcesClient", "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, "saas.ResourcesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.ResourcesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client ResourcesClient) ListComplete(ctx context.Context) (result ResourceResponseWithContinuationIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ResourcesClient.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/saas/mgmt/2018-03-01-preview/saas/saas.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/saas.go new file mode 100644 index 000000000000..7a05bb71da99 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/saas.go @@ -0,0 +1,342 @@ +package saas + +// 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" +) + +// Client is the REST APIs for Azure Marketplace SaaS Offers +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)} +} + +// CreateResource creates a SaaS resource. +// Parameters: +// parameters - parameters supplied to the create saas operation. +func (client Client) CreateResource(ctx context.Context, parameters ResourceCreation) (result CreateResourceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.CreateResource") + 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.CreateResourcePreparer(ctx, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "CreateResource", nil, "Failure preparing request") + return + } + + result, err = client.CreateResourceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "CreateResource", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateResourcePreparer prepares the CreateResource request. +func (client Client) CreateResourcePreparer(ctx context.Context, parameters ResourceCreation) (*http.Request, error) { + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.SaaS/saasresources"), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateResourceSender sends the CreateResource request. The method will close the +// http.Response Body if it receives an error. +func (client Client) CreateResourceSender(req *http.Request) (future CreateResourceFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// CreateResourceResponder handles the response to the CreateResource request. The method always +// closes the http.Response Body. +func (client Client) CreateResourceResponder(resp *http.Response) (result Resource, 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 deletes the specified SaaS. +// Parameters: +// resourceID - the Saas resource ID. This is a GUID-formatted string (e.g. +// 00000000-0000-0000-0000-000000000000) +// parameters - parameters supplied to delete saas operation. +func (client Client) Delete(ctx context.Context, resourceID string, parameters DeleteOptions) (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) + }() + } + req, err := client.DeletePreparer(ctx, resourceID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client Client) DeletePreparer(ctx context.Context, resourceID string, parameters DeleteOptions) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.SaaS/saasresources/{resourceId}", pathParameters), + autorest.WithJSON(parameters), + 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, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + 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 autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// GetResource gets information about the specified SaaS. +// Parameters: +// resourceID - the Saas resource ID. This is a GUID-formatted string (e.g. +// 00000000-0000-0000-0000-000000000000) +func (client Client) GetResource(ctx context.Context, resourceID string) (result Resource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.GetResource") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetResourcePreparer(ctx, resourceID) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "GetResource", nil, "Failure preparing request") + return + } + + resp, err := client.GetResourceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.Client", "GetResource", resp, "Failure sending request") + return + } + + result, err = client.GetResourceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "GetResource", resp, "Failure responding to request") + return + } + + return +} + +// GetResourcePreparer prepares the GetResource request. +func (client Client) GetResourcePreparer(ctx context.Context, resourceID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.SaaS/saasresources/{resourceId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetResourceSender sends the GetResource request. The method will close the +// http.Response Body if it receives an error. +func (client Client) GetResourceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResourceResponder handles the response to the GetResource request. The method always +// closes the http.Response Body. +func (client Client) GetResourceResponder(resp *http.Response) (result Resource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateResource updates a SaaS resource. +// Parameters: +// resourceID - the Saas resource ID. This is a GUID-formatted string (e.g. +// 00000000-0000-0000-0000-000000000000) +// parameters - parameters supplied to the update saas operation. +func (client Client) UpdateResource(ctx context.Context, resourceID string, parameters ResourceCreation) (result UpdateResourceFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/Client.UpdateResource") + 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.UpdateResourcePreparer(ctx, resourceID, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "UpdateResource", nil, "Failure preparing request") + return + } + + result, err = client.UpdateResourceSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.Client", "UpdateResource", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateResourcePreparer prepares the UpdateResource request. +func (client Client) UpdateResourcePreparer(ctx context.Context, resourceID string, parameters ResourceCreation) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceId": autorest.Encode("path", resourceID), + } + + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Type = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.SaaS/saasresources/{resourceId}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateResourceSender sends the UpdateResource request. The method will close the +// http.Response Body if it receives an error. +func (client Client) UpdateResourceSender(req *http.Request) (future UpdateResourceFuture, err error) { + var resp *http.Response + future.FutureAPI = &azure.Future{} + resp, err = client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = future.result + return +} + +// UpdateResourceResponder handles the response to the UpdateResource request. The method always +// closes the http.Response Body. +func (client Client) UpdateResourceResponder(resp *http.Response) (result Resource, 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 +} diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/saasapi/interfaces.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/saasapi/interfaces.go new file mode 100644 index 000000000000..5dbbadd73970 --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/saasapi/interfaces.go @@ -0,0 +1,79 @@ +package saasapi + +// 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/saas/mgmt/2018-03-01-preview/saas" + "github.com/Azure/go-autorest/autorest" +) + +// BaseClientAPI contains the set of methods on the BaseClient type. +type BaseClientAPI interface { + ResourceListAccessToken(ctx context.Context, resourceID string) (result saas.AccessTokenResult, err error) +} + +var _ BaseClientAPI = (*saas.BaseClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result saas.AppOperationsResponseWithContinuationPage, err error) + ListComplete(ctx context.Context) (result saas.AppOperationsResponseWithContinuationIterator, err error) +} + +var _ OperationsClientAPI = (*saas.OperationsClient)(nil) + +// ApplicationsClientAPI contains the set of methods on the ApplicationsClient type. +type ApplicationsClientAPI interface { + List(ctx context.Context, resourceGroupName string) (result saas.AppResponseWithContinuationPage, err error) + ListComplete(ctx context.Context, resourceGroupName string) (result saas.AppResponseWithContinuationIterator, err error) +} + +var _ ApplicationsClientAPI = (*saas.ApplicationsClient)(nil) + +// ClientAPI contains the set of methods on the Client type. +type ClientAPI interface { + CreateResource(ctx context.Context, parameters saas.ResourceCreation) (result saas.CreateResourceFuture, err error) + Delete(ctx context.Context, resourceID string, parameters saas.DeleteOptions) (result saas.DeleteFuture, err error) + GetResource(ctx context.Context, resourceID string) (result saas.Resource, err error) + UpdateResource(ctx context.Context, resourceID string, parameters saas.ResourceCreation) (result saas.UpdateResourceFuture, err error) +} + +var _ ClientAPI = (*saas.Client)(nil) + +// ResourcesClientAPI contains the set of methods on the ResourcesClient type. +type ResourcesClientAPI interface { + List(ctx context.Context) (result saas.ResourceResponseWithContinuationPage, err error) + ListComplete(ctx context.Context) (result saas.ResourceResponseWithContinuationIterator, err error) +} + +var _ ResourcesClientAPI = (*saas.ResourcesClient)(nil) + +// SubscriptionLevelClientAPI contains the set of methods on the SubscriptionLevelClient type. +type SubscriptionLevelClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters saas.ResourceCreation) (result saas.SubscriptionLevelCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, resourceName string) (result saas.SubscriptionLevelDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, resourceName string) (result saas.Resource, err error) + ListAccessToken(ctx context.Context, resourceGroupName string, resourceName string) (result saas.AccessTokenResult, err error) + ListByAzureSubscription(ctx context.Context) (result saas.ResourceResponseWithContinuationPage, err error) + ListByAzureSubscriptionComplete(ctx context.Context) (result saas.ResourceResponseWithContinuationIterator, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result saas.ResourceResponseWithContinuationPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result saas.ResourceResponseWithContinuationIterator, err error) + MoveResources(ctx context.Context, resourceGroupName string, moveResourceParameter saas.MoveResource) (result saas.SubscriptionLevelMoveResourcesFuture, err error) + Update(ctx context.Context, resourceGroupName string, resourceName string, parameters saas.ResourceCreation) (result saas.SubscriptionLevelUpdateFuture, err error) + UpdateToUnsubscribed(ctx context.Context, resourceGroupName string, resourceName string, parameters saas.DeleteOptions) (result saas.SubscriptionLevelUpdateToUnsubscribedFuture, err error) + ValidateMoveResources(ctx context.Context, resourceGroupName string, moveResourceParameter saas.MoveResource) (result autorest.Response, err error) +} + +var _ SubscriptionLevelClientAPI = (*saas.SubscriptionLevelClient)(nil) + +// OperationClientAPI contains the set of methods on the OperationClient type. +type OperationClientAPI interface { + Get(ctx context.Context, operationID string) (result saas.OperationGetFuture, err error) +} + +var _ OperationClientAPI = (*saas.OperationClient)(nil) diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/subscriptionlevel.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/subscriptionlevel.go new file mode 100644 index 000000000000..34f87f8c1b6e --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/subscriptionlevel.go @@ -0,0 +1,895 @@ +package saas + +// 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" +) + +// SubscriptionLevelClient is the REST APIs for Azure Marketplace SaaS Offers +type SubscriptionLevelClient struct { + BaseClient +} + +// NewSubscriptionLevelClient creates an instance of the SubscriptionLevelClient client. +func NewSubscriptionLevelClient(subscriptionID string) SubscriptionLevelClient { + return NewSubscriptionLevelClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubscriptionLevelClientWithBaseURI creates an instance of the SubscriptionLevelClient 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 NewSubscriptionLevelClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionLevelClient { + return SubscriptionLevelClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a SaaS resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the resource. +// parameters - parameters supplied to the create or update subscription level saas operation. +func (client SubscriptionLevelClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceCreation) (result SubscriptionLevelCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.CreateOrUpdate") + 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.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SubscriptionLevelClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceCreation) (*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 = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Type = 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.SaaS/resources/{resourceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionLevelClient) CreateOrUpdateSender(req *http.Request) (future SubscriptionLevelCreateOrUpdateFuture, 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 SubscriptionLevelClient) CreateOrUpdateResponder(resp *http.Response) (result Resource, 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 +} + +// Delete deletes the specified SaaS. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the resource. +func (client SubscriptionLevelClient) Delete(ctx context.Context, resourceGroupName string, resourceName string) (result SubscriptionLevelDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.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, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SubscriptionLevelClient) 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 = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{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 SubscriptionLevelClient) DeleteSender(req *http.Request) (future SubscriptionLevelDeleteFuture, 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 SubscriptionLevelClient) 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 information about the specified Subscription Level SaaS. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the resource. +func (client SubscriptionLevelClient) Get(ctx context.Context, resourceGroupName string, resourceName string) (result Resource, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.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, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubscriptionLevelClient) 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 = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{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 SubscriptionLevelClient) 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 SubscriptionLevelClient) GetResponder(resp *http.Response) (result Resource, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListAccessToken gets the ISV access token for a specified Subscription Level SaaS. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the resource. +func (client SubscriptionLevelClient) ListAccessToken(ctx context.Context, resourceGroupName string, resourceName string) (result AccessTokenResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.ListAccessToken") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListAccessTokenPreparer(ctx, resourceGroupName, resourceName) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListAccessToken", nil, "Failure preparing request") + return + } + + resp, err := client.ListAccessTokenSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListAccessToken", resp, "Failure sending request") + return + } + + result, err = client.ListAccessTokenResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListAccessToken", resp, "Failure responding to request") + return + } + + return +} + +// ListAccessTokenPreparer prepares the ListAccessToken request. +func (client SubscriptionLevelClient) ListAccessTokenPreparer(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 = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources/{resourceName}/listAccessToken", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListAccessTokenSender sends the ListAccessToken request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionLevelClient) ListAccessTokenSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListAccessTokenResponder handles the response to the ListAccessToken request. The method always +// closes the http.Response Body. +func (client SubscriptionLevelClient) ListAccessTokenResponder(resp *http.Response) (result AccessTokenResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAzureSubscription gets information about all the Subscription Level SaaS in a certain Azure subscription. +func (client SubscriptionLevelClient) ListByAzureSubscription(ctx context.Context) (result ResourceResponseWithContinuationPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.ListByAzureSubscription") + defer func() { + sc := -1 + if result.rrwc.Response.Response != nil { + sc = result.rrwc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByAzureSubscriptionNextResults + req, err := client.ListByAzureSubscriptionPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListByAzureSubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAzureSubscriptionSender(req) + if err != nil { + result.rrwc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListByAzureSubscription", resp, "Failure sending request") + return + } + + result.rrwc, err = client.ListByAzureSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListByAzureSubscription", resp, "Failure responding to request") + return + } + if result.rrwc.hasNextLink() && result.rrwc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByAzureSubscriptionPreparer prepares the ListByAzureSubscription request. +func (client SubscriptionLevelClient) ListByAzureSubscriptionPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.SaaS/resources", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByAzureSubscriptionSender sends the ListByAzureSubscription request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionLevelClient) ListByAzureSubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByAzureSubscriptionResponder handles the response to the ListByAzureSubscription request. The method always +// closes the http.Response Body. +func (client SubscriptionLevelClient) ListByAzureSubscriptionResponder(resp *http.Response) (result ResourceResponseWithContinuation, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByAzureSubscriptionNextResults retrieves the next set of results, if any. +func (client SubscriptionLevelClient) listByAzureSubscriptionNextResults(ctx context.Context, lastResults ResourceResponseWithContinuation) (result ResourceResponseWithContinuation, err error) { + req, err := lastResults.resourceResponseWithContinuationPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "listByAzureSubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByAzureSubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "listByAzureSubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByAzureSubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "listByAzureSubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByAzureSubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubscriptionLevelClient) ListByAzureSubscriptionComplete(ctx context.Context) (result ResourceResponseWithContinuationIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.ListByAzureSubscription") + 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.ListByAzureSubscription(ctx) + return +} + +// ListByResourceGroup gets information about all the Subscription Level SaaS in a certain resource group. +// Parameters: +// resourceGroupName - the name of the resource group. +func (client SubscriptionLevelClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ResourceResponseWithContinuationPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.rrwc.Response.Response != nil { + sc = result.rrwc.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.rrwc.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.rrwc, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.rrwc.hasNextLink() && result.rrwc.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client SubscriptionLevelClient) 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 = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SaaS/resources", 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 SubscriptionLevelClient) 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 SubscriptionLevelClient) ListByResourceGroupResponder(resp *http.Response) (result ResourceResponseWithContinuation, 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 SubscriptionLevelClient) listByResourceGroupNextResults(ctx context.Context, lastResults ResourceResponseWithContinuation) (result ResourceResponseWithContinuation, err error) { + req, err := lastResults.resourceResponseWithContinuationPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "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, "saas.SubscriptionLevelClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubscriptionLevelClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ResourceResponseWithContinuationIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.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 +} + +// MoveResources move a specified Subscription Level SaaS. +// Parameters: +// resourceGroupName - the name of the resource group. +// moveResourceParameter - object that represents the resources to move. +func (client SubscriptionLevelClient) MoveResources(ctx context.Context, resourceGroupName string, moveResourceParameter MoveResource) (result SubscriptionLevelMoveResourcesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.MoveResources") + 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.MoveResourcesPreparer(ctx, resourceGroupName, moveResourceParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "MoveResources", nil, "Failure preparing request") + return + } + + result, err = client.MoveResourcesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "MoveResources", result.Response(), "Failure sending request") + return + } + + return +} + +// MoveResourcesPreparer prepares the MoveResources request. +func (client SubscriptionLevelClient) MoveResourcesPreparer(ctx context.Context, resourceGroupName string, moveResourceParameter MoveResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01-beta" + 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}/moveResources", pathParameters), + autorest.WithJSON(moveResourceParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// MoveResourcesSender sends the MoveResources request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionLevelClient) MoveResourcesSender(req *http.Request) (future SubscriptionLevelMoveResourcesFuture, 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 +} + +// MoveResourcesResponder handles the response to the MoveResources request. The method always +// closes the http.Response Body. +func (client SubscriptionLevelClient) MoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update updates a SaaS Subscription Level resource. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the resource. +// parameters - parameters supplied to the update saas operation. +func (client SubscriptionLevelClient) Update(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceCreation) (result SubscriptionLevelUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.Update") + 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.UpdatePreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client SubscriptionLevelClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters ResourceCreation) (*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 = "2018-03-01-beta" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.ID = nil + parameters.Type = 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.SaaS/resources/{resourceName}", 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 SubscriptionLevelClient) UpdateSender(req *http.Request) (future SubscriptionLevelUpdateFuture, 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 SubscriptionLevelClient) UpdateResponder(resp *http.Response) (result Resource, 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 +} + +// UpdateToUnsubscribed unsubscribe from a specified Subscription Level SaaS. +// Parameters: +// resourceGroupName - the name of the resource group. +// resourceName - the name of the resource. +// parameters - parameters supplied to unsubscribe saas operation. +func (client SubscriptionLevelClient) UpdateToUnsubscribed(ctx context.Context, resourceGroupName string, resourceName string, parameters DeleteOptions) (result SubscriptionLevelUpdateToUnsubscribedFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.UpdateToUnsubscribed") + 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.UpdateToUnsubscribedPreparer(ctx, resourceGroupName, resourceName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "UpdateToUnsubscribed", nil, "Failure preparing request") + return + } + + result, err = client.UpdateToUnsubscribedSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "UpdateToUnsubscribed", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdateToUnsubscribedPreparer prepares the UpdateToUnsubscribed request. +func (client SubscriptionLevelClient) UpdateToUnsubscribedPreparer(ctx context.Context, resourceGroupName string, resourceName string, parameters DeleteOptions) (*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 = "2018-03-01-beta" + 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.SaaS/resources/{resourceName}/unsubscribe", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateToUnsubscribedSender sends the UpdateToUnsubscribed request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionLevelClient) UpdateToUnsubscribedSender(req *http.Request) (future SubscriptionLevelUpdateToUnsubscribedFuture, 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 +} + +// UpdateToUnsubscribedResponder handles the response to the UpdateToUnsubscribed request. The method always +// closes the http.Response Body. +func (client SubscriptionLevelClient) UpdateToUnsubscribedResponder(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 +} + +// ValidateMoveResources validate whether a specified Subscription Level SaaS can be moved. +// Parameters: +// resourceGroupName - the name of the resource group. +// moveResourceParameter - object that represents the resources to move. +func (client SubscriptionLevelClient) ValidateMoveResources(ctx context.Context, resourceGroupName string, moveResourceParameter MoveResource) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionLevelClient.ValidateMoveResources") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ValidateMoveResourcesPreparer(ctx, resourceGroupName, moveResourceParameter) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ValidateMoveResources", nil, "Failure preparing request") + return + } + + resp, err := client.ValidateMoveResourcesSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ValidateMoveResources", resp, "Failure sending request") + return + } + + result, err = client.ValidateMoveResourcesResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "saas.SubscriptionLevelClient", "ValidateMoveResources", resp, "Failure responding to request") + return + } + + return +} + +// ValidateMoveResourcesPreparer prepares the ValidateMoveResources request. +func (client SubscriptionLevelClient) ValidateMoveResourcesPreparer(ctx context.Context, resourceGroupName string, moveResourceParameter MoveResource) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-03-01-beta" + 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}/validateMoveResources", pathParameters), + autorest.WithJSON(moveResourceParameter), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ValidateMoveResourcesSender sends the ValidateMoveResources request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionLevelClient) ValidateMoveResourcesSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ValidateMoveResourcesResponder handles the response to the ValidateMoveResources request. The method always +// closes the http.Response Body. +func (client SubscriptionLevelClient) ValidateMoveResourcesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/saas/mgmt/2018-03-01-preview/saas/version.go b/services/preview/saas/mgmt/2018-03-01-preview/saas/version.go new file mode 100644 index 000000000000..92637ae495fe --- /dev/null +++ b/services/preview/saas/mgmt/2018-03-01-preview/saas/version.go @@ -0,0 +1,19 @@ +package saas + +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() + " saas/2018-03-01-beta" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}