diff --git a/profiles/preview/web/mgmt/web/models.go b/profiles/preview/web/mgmt/web/models.go index 76e0d47129b5..49e40ea40e32 100644 --- a/profiles/preview/web/mgmt/web/models.go +++ b/profiles/preview/web/mgmt/web/models.go @@ -282,6 +282,14 @@ const ( Hour FrequencyUnit = original.Hour ) +type FtpsState = original.FtpsState + +const ( + AllAllowed FtpsState = original.AllAllowed + Disabled FtpsState = original.Disabled + FtpsOnly FtpsState = original.FtpsOnly +) + type HostingEnvironmentStatus = original.HostingEnvironmentStatus const ( @@ -533,9 +541,9 @@ const ( type SslState = original.SslState const ( - Disabled SslState = original.Disabled - IPBasedEnabled SslState = original.IPBasedEnabled - SniEnabled SslState = original.SniEnabled + SslStateDisabled SslState = original.SslStateDisabled + SslStateIPBasedEnabled SslState = original.SslStateIPBasedEnabled + SslStateSniEnabled SslState = original.SslStateSniEnabled ) type StatusOptions = original.StatusOptions @@ -670,6 +678,8 @@ type AppsMigrateMySQLFuture = original.AppsMigrateMySQLFuture type AppsMigrateStorageFuture = original.AppsMigrateStorageFuture type AppsRestoreFromBackupBlobFuture = original.AppsRestoreFromBackupBlobFuture type AppsRestoreFromBackupBlobSlotFuture = original.AppsRestoreFromBackupBlobSlotFuture +type AppsRestoreFromDeletedAppFuture = original.AppsRestoreFromDeletedAppFuture +type AppsRestoreFromDeletedAppSlotFuture = original.AppsRestoreFromDeletedAppSlotFuture type AppsRestoreFuture = original.AppsRestoreFuture type AppsRestoreSlotFuture = original.AppsRestoreSlotFuture type AppsRestoreSnapshotFuture = original.AppsRestoreSnapshotFuture @@ -740,6 +750,8 @@ type DataSource = original.DataSource type DefaultErrorResponse = original.DefaultErrorResponse type DefaultErrorResponseError = original.DefaultErrorResponseError type DefaultErrorResponseErrorDetailsItem = original.DefaultErrorResponseErrorDetailsItem +type DeletedAppRestoreRequest = original.DeletedAppRestoreRequest +type DeletedAppRestoreRequestProperties = original.DeletedAppRestoreRequestProperties type DeletedSite = original.DeletedSite type DeletedWebAppCollection = original.DeletedWebAppCollection type DeletedWebAppCollectionIterator = original.DeletedWebAppCollectionIterator @@ -1226,6 +1238,9 @@ func PossibleDomainTypeValues() []DomainType { func PossibleFrequencyUnitValues() []FrequencyUnit { return original.PossibleFrequencyUnitValues() } +func PossibleFtpsStateValues() []FtpsState { + return original.PossibleFtpsStateValues() +} func PossibleHostingEnvironmentStatusValues() []HostingEnvironmentStatus { return original.PossibleHostingEnvironmentStatusValues() } diff --git a/services/web/mgmt/2018-02-01/web/apps.go b/services/web/mgmt/2018-02-01/web/apps.go index 577cdf275a31..3e671e6171c9 100644 --- a/services/web/mgmt/2018-02-01/web/apps.go +++ b/services/web/mgmt/2018-02-01/web/apps.go @@ -22403,6 +22403,166 @@ func (client AppsClient) RestoreFromBackupBlobSlotResponder(resp *http.Response) return } +// RestoreFromDeletedApp restores a deleted web app to this web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// restoreRequest - deleted web app restore information. +func (client AppsClient) RestoreFromDeletedApp(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest) (result AppsRestoreFromDeletedAppFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreFromDeletedApp", err.Error()) + } + + req, err := client.RestoreFromDeletedAppPreparer(ctx, resourceGroupName, name, restoreRequest) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedApp", nil, "Failure preparing request") + return + } + + result, err = client.RestoreFromDeletedAppSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedApp", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreFromDeletedAppPreparer prepares the RestoreFromDeletedApp request. +func (client AppsClient) RestoreFromDeletedAppPreparer(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/restoreFromDeletedApp", pathParameters), + autorest.WithJSON(restoreRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreFromDeletedAppSender sends the RestoreFromDeletedApp request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreFromDeletedAppSender(req *http.Request) (future AppsRestoreFromDeletedAppFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return +} + +// RestoreFromDeletedAppResponder handles the response to the RestoreFromDeletedApp request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreFromDeletedAppResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// RestoreFromDeletedAppSlot restores a deleted web app to this web app. +// Parameters: +// resourceGroupName - name of the resource group to which the resource belongs. +// name - name of web app. +// restoreRequest - deleted web app restore information. +// slot - name of web app slot. If not specified then will default to production slot. +func (client AppsClient) RestoreFromDeletedAppSlot(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest, slot string) (result AppsRestoreFromDeletedAppSlotFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+[^\.]$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("web.AppsClient", "RestoreFromDeletedAppSlot", err.Error()) + } + + req, err := client.RestoreFromDeletedAppSlotPreparer(ctx, resourceGroupName, name, restoreRequest, slot) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedAppSlot", nil, "Failure preparing request") + return + } + + result, err = client.RestoreFromDeletedAppSlotSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsClient", "RestoreFromDeletedAppSlot", result.Response(), "Failure sending request") + return + } + + return +} + +// RestoreFromDeletedAppSlotPreparer prepares the RestoreFromDeletedAppSlot request. +func (client AppsClient) RestoreFromDeletedAppSlotPreparer(ctx context.Context, resourceGroupName string, name string, restoreRequest DeletedAppRestoreRequest, slot string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "slot": autorest.Encode("path", slot), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2018-02-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/restoreFromDeletedApp", pathParameters), + autorest.WithJSON(restoreRequest), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RestoreFromDeletedAppSlotSender sends the RestoreFromDeletedAppSlot request. The method will close the +// http.Response Body if it receives an error. +func (client AppsClient) RestoreFromDeletedAppSlotSender(req *http.Request) (future AppsRestoreFromDeletedAppSlotFuture, err error) { + sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client)) + future.Future = azure.NewFuture(req) + future.req = req + _, err = future.Done(sender) + if err != nil { + return + } + err = autorest.Respond(future.Response(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) + return +} + +// RestoreFromDeletedAppSlotResponder handles the response to the RestoreFromDeletedAppSlot request. The method always +// closes the http.Response Body. +func (client AppsClient) RestoreFromDeletedAppSlotResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + // RestoreSlot restores a specific backup to another app (or deployment slot, if specified). // Parameters: // resourceGroupName - name of the resource group to which the resource belongs. diff --git a/services/web/mgmt/2018-02-01/web/models.go b/services/web/mgmt/2018-02-01/web/models.go index a23c6b561f05..e138f0828b00 100644 --- a/services/web/mgmt/2018-02-01/web/models.go +++ b/services/web/mgmt/2018-02-01/web/models.go @@ -541,6 +541,23 @@ func PossibleFrequencyUnitValues() []FrequencyUnit { return []FrequencyUnit{Day, Hour} } +// FtpsState enumerates the values for ftps state. +type FtpsState string + +const ( + // AllAllowed ... + AllAllowed FtpsState = "AllAllowed" + // Disabled ... + Disabled FtpsState = "Disabled" + // FtpsOnly ... + FtpsOnly FtpsState = "FtpsOnly" +) + +// PossibleFtpsStateValues returns an array of possible values for the FtpsState const type. +func PossibleFtpsStateValues() []FtpsState { + return []FtpsState{AllAllowed, Disabled, FtpsOnly} +} + // HostingEnvironmentStatus enumerates the values for hosting environment status. type HostingEnvironmentStatus string @@ -1068,17 +1085,17 @@ func PossibleSolutionTypeValues() []SolutionType { type SslState string const ( - // Disabled ... - Disabled SslState = "Disabled" - // IPBasedEnabled ... - IPBasedEnabled SslState = "IpBasedEnabled" - // SniEnabled ... - SniEnabled SslState = "SniEnabled" + // SslStateDisabled ... + SslStateDisabled SslState = "Disabled" + // SslStateIPBasedEnabled ... + SslStateIPBasedEnabled SslState = "IpBasedEnabled" + // SslStateSniEnabled ... + SslStateSniEnabled SslState = "SniEnabled" ) // PossibleSslStateValues returns an array of possible values for the SslState const type. func PossibleSslStateValues() []SslState { - return []SslState{Disabled, IPBasedEnabled, SniEnabled} + return []SslState{SslStateDisabled, SslStateIPBasedEnabled, SslStateSniEnabled} } // StatusOptions enumerates the values for status options. @@ -4890,6 +4907,104 @@ func (future AppsRestoreFromBackupBlobSlotFuture) Result(client AppsClient) (ar return } +// AppsRestoreFromDeletedAppFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsRestoreFromDeletedAppFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future AppsRestoreFromDeletedAppFuture) Result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("web.AppsRestoreFromDeletedAppFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.RestoreFromDeletedAppResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.RestoreFromDeletedAppResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppFuture", "Result", resp, "Failure responding to request") + } + return +} + +// AppsRestoreFromDeletedAppSlotFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AppsRestoreFromDeletedAppSlotFuture struct { + azure.Future + req *http.Request +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future AppsRestoreFromDeletedAppSlotFuture) Result(client AppsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppSlotFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + return ar, azure.NewAsyncOpIncompleteError("web.AppsRestoreFromDeletedAppSlotFuture") + } + if future.PollingMethod() == azure.PollingLocation { + ar, err = client.RestoreFromDeletedAppSlotResponder(future.Response()) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppSlotFuture", "Result", future.Response(), "Failure responding to request") + } + return + } + var req *http.Request + var resp *http.Response + if future.PollingURL() != "" { + req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil) + if err != nil { + return + } + } else { + req = autorest.ChangeToGet(future.req) + } + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppSlotFuture", "Result", resp, "Failure sending request") + return + } + ar, err = client.RestoreFromDeletedAppSlotResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "web.AppsRestoreFromDeletedAppSlotFuture", "Result", resp, "Failure responding to request") + } + return +} + // AppsRestoreFuture an abstraction for monitoring and retrieving the results of a long-running operation. type AppsRestoreFuture struct { azure.Future @@ -7304,6 +7419,113 @@ type DefaultErrorResponseErrorDetailsItem struct { Target *string `json:"target,omitempty"` } +// DeletedAppRestoreRequest details about restoring a deleted app. +type DeletedAppRestoreRequest struct { + // DeletedAppRestoreRequestProperties - DeletedAppRestoreRequest resource specific properties + *DeletedAppRestoreRequestProperties `json:"properties,omitempty"` + // ID - Resource Id. + ID *string `json:"id,omitempty"` + // Name - Resource Name. + Name *string `json:"name,omitempty"` + // Kind - Kind of resource. + Kind *string `json:"kind,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeletedAppRestoreRequest. +func (darr DeletedAppRestoreRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if darr.DeletedAppRestoreRequestProperties != nil { + objectMap["properties"] = darr.DeletedAppRestoreRequestProperties + } + if darr.ID != nil { + objectMap["id"] = darr.ID + } + if darr.Name != nil { + objectMap["name"] = darr.Name + } + if darr.Kind != nil { + objectMap["kind"] = darr.Kind + } + if darr.Type != nil { + objectMap["type"] = darr.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeletedAppRestoreRequest struct. +func (darr *DeletedAppRestoreRequest) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var deletedAppRestoreRequestProperties DeletedAppRestoreRequestProperties + err = json.Unmarshal(*v, &deletedAppRestoreRequestProperties) + if err != nil { + return err + } + darr.DeletedAppRestoreRequestProperties = &deletedAppRestoreRequestProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + darr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + darr.Name = &name + } + case "kind": + if v != nil { + var kind string + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + darr.Kind = &kind + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + darr.Type = &typeVar + } + } + } + + return nil +} + +// DeletedAppRestoreRequestProperties deletedAppRestoreRequest resource specific properties +type DeletedAppRestoreRequestProperties struct { + // DeletedSiteID - ARM resource ID of the deleted app. Example: + // /subscriptions/{subId}/providers/Microsoft.Web/deletedSites/{deletedSiteId} + DeletedSiteID *string `json:"deletedSiteId,omitempty"` + // RecoverConfiguration - If true, deleted site configuration, in addition to content, will be restored. + RecoverConfiguration *bool `json:"recoverConfiguration,omitempty"` + // SnapshotTime - Point in time to restore the deleted app from, formatted as a DateTime string. + // If unspecified, default value is the time that the app was deleted. + SnapshotTime *string `json:"snapshotTime,omitempty"` +} + // DeletedSite a deleted app. type DeletedSite struct { // DeletedSiteID - Numeric id for the deleted site @@ -10055,7 +10277,7 @@ type HostNameBindingProperties struct { CustomHostNameDNSRecordType CustomHostNameDNSRecordType `json:"customHostNameDnsRecordType,omitempty"` // HostNameType - Hostname type. Possible values include: 'Verified', 'Managed' HostNameType HostNameType `json:"hostNameType,omitempty"` - // SslState - SSL type. Possible values include: 'Disabled', 'SniEnabled', 'IPBasedEnabled' + // SslState - SSL type. Possible values include: 'SslStateDisabled', 'SslStateSniEnabled', 'SslStateIPBasedEnabled' SslState SslState `json:"sslState,omitempty"` // Thumbprint - SSL certificate thumbprint Thumbprint *string `json:"thumbprint,omitempty"` @@ -10067,7 +10289,7 @@ type HostNameBindingProperties struct { type HostNameSslState struct { // Name - Hostname. Name *string `json:"name,omitempty"` - // SslState - SSL type. Possible values include: 'Disabled', 'SniEnabled', 'IPBasedEnabled' + // SslState - SSL type. Possible values include: 'SslStateDisabled', 'SslStateSniEnabled', 'SslStateIPBasedEnabled' SslState SslState `json:"sslState,omitempty"` // VirtualIP - Virtual IP address assigned to the hostname if IP based SSL is enabled. VirtualIP *string `json:"virtualIP,omitempty"` @@ -15675,6 +15897,8 @@ type SiteConfig struct { HTTP20Enabled *bool `json:"http20Enabled,omitempty"` // MinTLSVersion - MinTlsVersion: configures the minimum version of TLS required for SSL requests. Possible values include: 'OneFullStopZero', 'OneFullStopOne', 'OneFullStopTwo' MinTLSVersion SupportedTLSVersions `json:"minTlsVersion,omitempty"` + // FtpsState - State of FTP / FTPS service. Possible values include: 'AllAllowed', 'FtpsOnly', 'Disabled' + FtpsState FtpsState `json:"ftpsState,omitempty"` } // SiteConfigResource web app configuration ARM resource.