...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform/deployments.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/appplatform/mgmt/2021-09-01-preview/appplatform

     1  package appplatform
     2  
     3  // Copyright (c) Microsoft Corporation. All rights reserved.
     4  // Licensed under the MIT License. See License.txt in the project root for license information.
     5  //
     6  // Code generated by Microsoft (R) AutoRest Code Generator.
     7  // Changes may cause incorrect behavior and will be lost if the code is regenerated.
     8  
     9  import (
    10  	"context"
    11  	"github.com/Azure/go-autorest/autorest"
    12  	"github.com/Azure/go-autorest/autorest/azure"
    13  	"github.com/Azure/go-autorest/tracing"
    14  	"net/http"
    15  )
    16  
    17  // DeploymentsClient is the REST API for Azure Spring Cloud
    18  type DeploymentsClient struct {
    19  	BaseClient
    20  }
    21  
    22  // NewDeploymentsClient creates an instance of the DeploymentsClient client.
    23  func NewDeploymentsClient(subscriptionID string) DeploymentsClient {
    24  	return NewDeploymentsClientWithBaseURI(DefaultBaseURI, subscriptionID)
    25  }
    26  
    27  // NewDeploymentsClientWithBaseURI creates an instance of the DeploymentsClient client using a custom endpoint.  Use
    28  // this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
    29  func NewDeploymentsClientWithBaseURI(baseURI string, subscriptionID string) DeploymentsClient {
    30  	return DeploymentsClient{NewWithBaseURI(baseURI, subscriptionID)}
    31  }
    32  
    33  // CreateOrUpdate create a new Deployment or update an exiting Deployment.
    34  // Parameters:
    35  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
    36  // from the Azure Resource Manager API or the portal.
    37  // serviceName - the name of the Service resource.
    38  // appName - the name of the App resource.
    39  // deploymentName - the name of the Deployment resource.
    40  // deploymentResource - parameters for the create or update operation
    41  func (client DeploymentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsCreateOrUpdateFuture, err error) {
    42  	if tracing.IsEnabled() {
    43  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.CreateOrUpdate")
    44  		defer func() {
    45  			sc := -1
    46  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
    47  				sc = result.FutureAPI.Response().StatusCode
    48  			}
    49  			tracing.EndSpan(ctx, sc, err)
    50  		}()
    51  	}
    52  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource)
    53  	if err != nil {
    54  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", nil, "Failure preparing request")
    55  		return
    56  	}
    57  
    58  	result, err = client.CreateOrUpdateSender(req)
    59  	if err != nil {
    60  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
    61  		return
    62  	}
    63  
    64  	return
    65  }
    66  
    67  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
    68  func (client DeploymentsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) {
    69  	pathParameters := map[string]interface{}{
    70  		"appName":           autorest.Encode("path", appName),
    71  		"deploymentName":    autorest.Encode("path", deploymentName),
    72  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
    73  		"serviceName":       autorest.Encode("path", serviceName),
    74  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    75  	}
    76  
    77  	const APIVersion = "2021-09-01-preview"
    78  	queryParameters := map[string]interface{}{
    79  		"api-version": APIVersion,
    80  	}
    81  
    82  	preparer := autorest.CreatePreparer(
    83  		autorest.AsContentType("application/json; charset=utf-8"),
    84  		autorest.AsPut(),
    85  		autorest.WithBaseURL(client.BaseURI),
    86  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters),
    87  		autorest.WithJSON(deploymentResource),
    88  		autorest.WithQueryParameters(queryParameters))
    89  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    90  }
    91  
    92  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
    93  // http.Response Body if it receives an error.
    94  func (client DeploymentsClient) CreateOrUpdateSender(req *http.Request) (future DeploymentsCreateOrUpdateFuture, err error) {
    95  	var resp *http.Response
    96  	future.FutureAPI = &azure.Future{}
    97  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
    98  	if err != nil {
    99  		return
   100  	}
   101  	var azf azure.Future
   102  	azf, err = azure.NewFutureFromResponse(resp)
   103  	future.FutureAPI = &azf
   104  	future.Result = future.result
   105  	return
   106  }
   107  
   108  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
   109  // closes the http.Response Body.
   110  func (client DeploymentsClient) CreateOrUpdateResponder(resp *http.Response) (result DeploymentResource, err error) {
   111  	err = autorest.Respond(
   112  		resp,
   113  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted),
   114  		autorest.ByUnmarshallingJSON(&result),
   115  		autorest.ByClosing())
   116  	result.Response = autorest.Response{Response: resp}
   117  	return
   118  }
   119  
   120  // Delete operation to delete a Deployment.
   121  // Parameters:
   122  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   123  // from the Azure Resource Manager API or the portal.
   124  // serviceName - the name of the Service resource.
   125  // appName - the name of the App resource.
   126  // deploymentName - the name of the Deployment resource.
   127  func (client DeploymentsClient) Delete(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsDeleteFuture, err error) {
   128  	if tracing.IsEnabled() {
   129  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Delete")
   130  		defer func() {
   131  			sc := -1
   132  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   133  				sc = result.FutureAPI.Response().StatusCode
   134  			}
   135  			tracing.EndSpan(ctx, sc, err)
   136  		}()
   137  	}
   138  	req, err := client.DeletePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName)
   139  	if err != nil {
   140  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", nil, "Failure preparing request")
   141  		return
   142  	}
   143  
   144  	result, err = client.DeleteSender(req)
   145  	if err != nil {
   146  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Delete", result.Response(), "Failure sending request")
   147  		return
   148  	}
   149  
   150  	return
   151  }
   152  
   153  // DeletePreparer prepares the Delete request.
   154  func (client DeploymentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) {
   155  	pathParameters := map[string]interface{}{
   156  		"appName":           autorest.Encode("path", appName),
   157  		"deploymentName":    autorest.Encode("path", deploymentName),
   158  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   159  		"serviceName":       autorest.Encode("path", serviceName),
   160  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   161  	}
   162  
   163  	const APIVersion = "2021-09-01-preview"
   164  	queryParameters := map[string]interface{}{
   165  		"api-version": APIVersion,
   166  	}
   167  
   168  	preparer := autorest.CreatePreparer(
   169  		autorest.AsDelete(),
   170  		autorest.WithBaseURL(client.BaseURI),
   171  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters),
   172  		autorest.WithQueryParameters(queryParameters))
   173  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   174  }
   175  
   176  // DeleteSender sends the Delete request. The method will close the
   177  // http.Response Body if it receives an error.
   178  func (client DeploymentsClient) DeleteSender(req *http.Request) (future DeploymentsDeleteFuture, err error) {
   179  	var resp *http.Response
   180  	future.FutureAPI = &azure.Future{}
   181  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   182  	if err != nil {
   183  		return
   184  	}
   185  	var azf azure.Future
   186  	azf, err = azure.NewFutureFromResponse(resp)
   187  	future.FutureAPI = &azf
   188  	future.Result = future.result
   189  	return
   190  }
   191  
   192  // DeleteResponder handles the response to the Delete request. The method always
   193  // closes the http.Response Body.
   194  func (client DeploymentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   195  	err = autorest.Respond(
   196  		resp,
   197  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
   198  		autorest.ByClosing())
   199  	result.Response = resp
   200  	return
   201  }
   202  
   203  // GenerateHeapDump generate Heap Dump
   204  // Parameters:
   205  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   206  // from the Azure Resource Manager API or the portal.
   207  // serviceName - the name of the Service resource.
   208  // appName - the name of the App resource.
   209  // deploymentName - the name of the Deployment resource.
   210  // diagnosticParameters - parameters for the diagnostic operation
   211  func (client DeploymentsClient) GenerateHeapDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsGenerateHeapDumpFuture, err error) {
   212  	if tracing.IsEnabled() {
   213  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GenerateHeapDump")
   214  		defer func() {
   215  			sc := -1
   216  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   217  				sc = result.FutureAPI.Response().StatusCode
   218  			}
   219  			tracing.EndSpan(ctx, sc, err)
   220  		}()
   221  	}
   222  	req, err := client.GenerateHeapDumpPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters)
   223  	if err != nil {
   224  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateHeapDump", nil, "Failure preparing request")
   225  		return
   226  	}
   227  
   228  	result, err = client.GenerateHeapDumpSender(req)
   229  	if err != nil {
   230  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateHeapDump", result.Response(), "Failure sending request")
   231  		return
   232  	}
   233  
   234  	return
   235  }
   236  
   237  // GenerateHeapDumpPreparer prepares the GenerateHeapDump request.
   238  func (client DeploymentsClient) GenerateHeapDumpPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) {
   239  	pathParameters := map[string]interface{}{
   240  		"appName":           autorest.Encode("path", appName),
   241  		"deploymentName":    autorest.Encode("path", deploymentName),
   242  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   243  		"serviceName":       autorest.Encode("path", serviceName),
   244  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   245  	}
   246  
   247  	const APIVersion = "2021-09-01-preview"
   248  	queryParameters := map[string]interface{}{
   249  		"api-version": APIVersion,
   250  	}
   251  
   252  	preparer := autorest.CreatePreparer(
   253  		autorest.AsContentType("application/json; charset=utf-8"),
   254  		autorest.AsPost(),
   255  		autorest.WithBaseURL(client.BaseURI),
   256  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump", pathParameters),
   257  		autorest.WithJSON(diagnosticParameters),
   258  		autorest.WithQueryParameters(queryParameters))
   259  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   260  }
   261  
   262  // GenerateHeapDumpSender sends the GenerateHeapDump request. The method will close the
   263  // http.Response Body if it receives an error.
   264  func (client DeploymentsClient) GenerateHeapDumpSender(req *http.Request) (future DeploymentsGenerateHeapDumpFuture, err error) {
   265  	var resp *http.Response
   266  	future.FutureAPI = &azure.Future{}
   267  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   268  	if err != nil {
   269  		return
   270  	}
   271  	var azf azure.Future
   272  	azf, err = azure.NewFutureFromResponse(resp)
   273  	future.FutureAPI = &azf
   274  	future.Result = future.result
   275  	return
   276  }
   277  
   278  // GenerateHeapDumpResponder handles the response to the GenerateHeapDump request. The method always
   279  // closes the http.Response Body.
   280  func (client DeploymentsClient) GenerateHeapDumpResponder(resp *http.Response) (result autorest.Response, err error) {
   281  	err = autorest.Respond(
   282  		resp,
   283  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   284  		autorest.ByClosing())
   285  	result.Response = resp
   286  	return
   287  }
   288  
   289  // GenerateThreadDump generate Thread Dump
   290  // Parameters:
   291  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   292  // from the Azure Resource Manager API or the portal.
   293  // serviceName - the name of the Service resource.
   294  // appName - the name of the App resource.
   295  // deploymentName - the name of the Deployment resource.
   296  // diagnosticParameters - parameters for the diagnostic operation
   297  func (client DeploymentsClient) GenerateThreadDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsGenerateThreadDumpFuture, err error) {
   298  	if tracing.IsEnabled() {
   299  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GenerateThreadDump")
   300  		defer func() {
   301  			sc := -1
   302  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   303  				sc = result.FutureAPI.Response().StatusCode
   304  			}
   305  			tracing.EndSpan(ctx, sc, err)
   306  		}()
   307  	}
   308  	req, err := client.GenerateThreadDumpPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters)
   309  	if err != nil {
   310  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateThreadDump", nil, "Failure preparing request")
   311  		return
   312  	}
   313  
   314  	result, err = client.GenerateThreadDumpSender(req)
   315  	if err != nil {
   316  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GenerateThreadDump", result.Response(), "Failure sending request")
   317  		return
   318  	}
   319  
   320  	return
   321  }
   322  
   323  // GenerateThreadDumpPreparer prepares the GenerateThreadDump request.
   324  func (client DeploymentsClient) GenerateThreadDumpPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) {
   325  	pathParameters := map[string]interface{}{
   326  		"appName":           autorest.Encode("path", appName),
   327  		"deploymentName":    autorest.Encode("path", deploymentName),
   328  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   329  		"serviceName":       autorest.Encode("path", serviceName),
   330  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   331  	}
   332  
   333  	const APIVersion = "2021-09-01-preview"
   334  	queryParameters := map[string]interface{}{
   335  		"api-version": APIVersion,
   336  	}
   337  
   338  	preparer := autorest.CreatePreparer(
   339  		autorest.AsContentType("application/json; charset=utf-8"),
   340  		autorest.AsPost(),
   341  		autorest.WithBaseURL(client.BaseURI),
   342  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump", pathParameters),
   343  		autorest.WithJSON(diagnosticParameters),
   344  		autorest.WithQueryParameters(queryParameters))
   345  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   346  }
   347  
   348  // GenerateThreadDumpSender sends the GenerateThreadDump request. The method will close the
   349  // http.Response Body if it receives an error.
   350  func (client DeploymentsClient) GenerateThreadDumpSender(req *http.Request) (future DeploymentsGenerateThreadDumpFuture, err error) {
   351  	var resp *http.Response
   352  	future.FutureAPI = &azure.Future{}
   353  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   354  	if err != nil {
   355  		return
   356  	}
   357  	var azf azure.Future
   358  	azf, err = azure.NewFutureFromResponse(resp)
   359  	future.FutureAPI = &azf
   360  	future.Result = future.result
   361  	return
   362  }
   363  
   364  // GenerateThreadDumpResponder handles the response to the GenerateThreadDump request. The method always
   365  // closes the http.Response Body.
   366  func (client DeploymentsClient) GenerateThreadDumpResponder(resp *http.Response) (result autorest.Response, err error) {
   367  	err = autorest.Respond(
   368  		resp,
   369  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   370  		autorest.ByClosing())
   371  	result.Response = resp
   372  	return
   373  }
   374  
   375  // Get get a Deployment and its properties.
   376  // Parameters:
   377  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   378  // from the Azure Resource Manager API or the portal.
   379  // serviceName - the name of the Service resource.
   380  // appName - the name of the App resource.
   381  // deploymentName - the name of the Deployment resource.
   382  func (client DeploymentsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentResource, err error) {
   383  	if tracing.IsEnabled() {
   384  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Get")
   385  		defer func() {
   386  			sc := -1
   387  			if result.Response.Response != nil {
   388  				sc = result.Response.Response.StatusCode
   389  			}
   390  			tracing.EndSpan(ctx, sc, err)
   391  		}()
   392  	}
   393  	req, err := client.GetPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName)
   394  	if err != nil {
   395  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", nil, "Failure preparing request")
   396  		return
   397  	}
   398  
   399  	resp, err := client.GetSender(req)
   400  	if err != nil {
   401  		result.Response = autorest.Response{Response: resp}
   402  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure sending request")
   403  		return
   404  	}
   405  
   406  	result, err = client.GetResponder(resp)
   407  	if err != nil {
   408  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Get", resp, "Failure responding to request")
   409  		return
   410  	}
   411  
   412  	return
   413  }
   414  
   415  // GetPreparer prepares the Get request.
   416  func (client DeploymentsClient) GetPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) {
   417  	pathParameters := map[string]interface{}{
   418  		"appName":           autorest.Encode("path", appName),
   419  		"deploymentName":    autorest.Encode("path", deploymentName),
   420  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   421  		"serviceName":       autorest.Encode("path", serviceName),
   422  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   423  	}
   424  
   425  	const APIVersion = "2021-09-01-preview"
   426  	queryParameters := map[string]interface{}{
   427  		"api-version": APIVersion,
   428  	}
   429  
   430  	preparer := autorest.CreatePreparer(
   431  		autorest.AsGet(),
   432  		autorest.WithBaseURL(client.BaseURI),
   433  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters),
   434  		autorest.WithQueryParameters(queryParameters))
   435  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   436  }
   437  
   438  // GetSender sends the Get request. The method will close the
   439  // http.Response Body if it receives an error.
   440  func (client DeploymentsClient) GetSender(req *http.Request) (*http.Response, error) {
   441  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   442  }
   443  
   444  // GetResponder handles the response to the Get request. The method always
   445  // closes the http.Response Body.
   446  func (client DeploymentsClient) GetResponder(resp *http.Response) (result DeploymentResource, err error) {
   447  	err = autorest.Respond(
   448  		resp,
   449  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   450  		autorest.ByUnmarshallingJSON(&result),
   451  		autorest.ByClosing())
   452  	result.Response = autorest.Response{Response: resp}
   453  	return
   454  }
   455  
   456  // GetLogFileURL get deployment log file URL
   457  // Parameters:
   458  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   459  // from the Azure Resource Manager API or the portal.
   460  // serviceName - the name of the Service resource.
   461  // appName - the name of the App resource.
   462  // deploymentName - the name of the Deployment resource.
   463  func (client DeploymentsClient) GetLogFileURL(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result LogFileURLResponse, err error) {
   464  	if tracing.IsEnabled() {
   465  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.GetLogFileURL")
   466  		defer func() {
   467  			sc := -1
   468  			if result.Response.Response != nil {
   469  				sc = result.Response.Response.StatusCode
   470  			}
   471  			tracing.EndSpan(ctx, sc, err)
   472  		}()
   473  	}
   474  	req, err := client.GetLogFileURLPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName)
   475  	if err != nil {
   476  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", nil, "Failure preparing request")
   477  		return
   478  	}
   479  
   480  	resp, err := client.GetLogFileURLSender(req)
   481  	if err != nil {
   482  		result.Response = autorest.Response{Response: resp}
   483  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure sending request")
   484  		return
   485  	}
   486  
   487  	result, err = client.GetLogFileURLResponder(resp)
   488  	if err != nil {
   489  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "GetLogFileURL", resp, "Failure responding to request")
   490  		return
   491  	}
   492  
   493  	return
   494  }
   495  
   496  // GetLogFileURLPreparer prepares the GetLogFileURL request.
   497  func (client DeploymentsClient) GetLogFileURLPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) {
   498  	pathParameters := map[string]interface{}{
   499  		"appName":           autorest.Encode("path", appName),
   500  		"deploymentName":    autorest.Encode("path", deploymentName),
   501  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   502  		"serviceName":       autorest.Encode("path", serviceName),
   503  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   504  	}
   505  
   506  	const APIVersion = "2021-09-01-preview"
   507  	queryParameters := map[string]interface{}{
   508  		"api-version": APIVersion,
   509  	}
   510  
   511  	preparer := autorest.CreatePreparer(
   512  		autorest.AsPost(),
   513  		autorest.WithBaseURL(client.BaseURI),
   514  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/getLogFileUrl", pathParameters),
   515  		autorest.WithQueryParameters(queryParameters))
   516  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   517  }
   518  
   519  // GetLogFileURLSender sends the GetLogFileURL request. The method will close the
   520  // http.Response Body if it receives an error.
   521  func (client DeploymentsClient) GetLogFileURLSender(req *http.Request) (*http.Response, error) {
   522  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   523  }
   524  
   525  // GetLogFileURLResponder handles the response to the GetLogFileURL request. The method always
   526  // closes the http.Response Body.
   527  func (client DeploymentsClient) GetLogFileURLResponder(resp *http.Response) (result LogFileURLResponse, err error) {
   528  	err = autorest.Respond(
   529  		resp,
   530  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   531  		autorest.ByUnmarshallingJSON(&result),
   532  		autorest.ByClosing())
   533  	result.Response = autorest.Response{Response: resp}
   534  	return
   535  }
   536  
   537  // List handles requests to list all resources in an App.
   538  // Parameters:
   539  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   540  // from the Azure Resource Manager API or the portal.
   541  // serviceName - the name of the Service resource.
   542  // appName - the name of the App resource.
   543  // version - version of the deployments to be listed
   544  func (client DeploymentsClient) List(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionPage, err error) {
   545  	if tracing.IsEnabled() {
   546  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.List")
   547  		defer func() {
   548  			sc := -1
   549  			if result.drc.Response.Response != nil {
   550  				sc = result.drc.Response.Response.StatusCode
   551  			}
   552  			tracing.EndSpan(ctx, sc, err)
   553  		}()
   554  	}
   555  	result.fn = client.listNextResults
   556  	req, err := client.ListPreparer(ctx, resourceGroupName, serviceName, appName, version)
   557  	if err != nil {
   558  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", nil, "Failure preparing request")
   559  		return
   560  	}
   561  
   562  	resp, err := client.ListSender(req)
   563  	if err != nil {
   564  		result.drc.Response = autorest.Response{Response: resp}
   565  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure sending request")
   566  		return
   567  	}
   568  
   569  	result.drc, err = client.ListResponder(resp)
   570  	if err != nil {
   571  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "List", resp, "Failure responding to request")
   572  		return
   573  	}
   574  	if result.drc.hasNextLink() && result.drc.IsEmpty() {
   575  		err = result.NextWithContext(ctx)
   576  		return
   577  	}
   578  
   579  	return
   580  }
   581  
   582  // ListPreparer prepares the List request.
   583  func (client DeploymentsClient) ListPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (*http.Request, error) {
   584  	pathParameters := map[string]interface{}{
   585  		"appName":           autorest.Encode("path", appName),
   586  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   587  		"serviceName":       autorest.Encode("path", serviceName),
   588  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   589  	}
   590  
   591  	const APIVersion = "2021-09-01-preview"
   592  	queryParameters := map[string]interface{}{
   593  		"api-version": APIVersion,
   594  	}
   595  	if version != nil && len(version) > 0 {
   596  		queryParameters["version"] = version
   597  	}
   598  
   599  	preparer := autorest.CreatePreparer(
   600  		autorest.AsGet(),
   601  		autorest.WithBaseURL(client.BaseURI),
   602  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments", pathParameters),
   603  		autorest.WithQueryParameters(queryParameters))
   604  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   605  }
   606  
   607  // ListSender sends the List request. The method will close the
   608  // http.Response Body if it receives an error.
   609  func (client DeploymentsClient) ListSender(req *http.Request) (*http.Response, error) {
   610  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   611  }
   612  
   613  // ListResponder handles the response to the List request. The method always
   614  // closes the http.Response Body.
   615  func (client DeploymentsClient) ListResponder(resp *http.Response) (result DeploymentResourceCollection, err error) {
   616  	err = autorest.Respond(
   617  		resp,
   618  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   619  		autorest.ByUnmarshallingJSON(&result),
   620  		autorest.ByClosing())
   621  	result.Response = autorest.Response{Response: resp}
   622  	return
   623  }
   624  
   625  // listNextResults retrieves the next set of results, if any.
   626  func (client DeploymentsClient) listNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) {
   627  	req, err := lastResults.deploymentResourceCollectionPreparer(ctx)
   628  	if err != nil {
   629  		return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", nil, "Failure preparing next results request")
   630  	}
   631  	if req == nil {
   632  		return
   633  	}
   634  	resp, err := client.ListSender(req)
   635  	if err != nil {
   636  		result.Response = autorest.Response{Response: resp}
   637  		return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure sending next results request")
   638  	}
   639  	result, err = client.ListResponder(resp)
   640  	if err != nil {
   641  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listNextResults", resp, "Failure responding to next results request")
   642  	}
   643  	return
   644  }
   645  
   646  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   647  func (client DeploymentsClient) ListComplete(ctx context.Context, resourceGroupName string, serviceName string, appName string, version []string) (result DeploymentResourceCollectionIterator, err error) {
   648  	if tracing.IsEnabled() {
   649  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.List")
   650  		defer func() {
   651  			sc := -1
   652  			if result.Response().Response.Response != nil {
   653  				sc = result.page.Response().Response.Response.StatusCode
   654  			}
   655  			tracing.EndSpan(ctx, sc, err)
   656  		}()
   657  	}
   658  	result.page, err = client.List(ctx, resourceGroupName, serviceName, appName, version)
   659  	return
   660  }
   661  
   662  // ListForCluster list deployments for a certain service
   663  // Parameters:
   664  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   665  // from the Azure Resource Manager API or the portal.
   666  // serviceName - the name of the Service resource.
   667  // version - version of the deployments to be listed
   668  func (client DeploymentsClient) ListForCluster(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionPage, err error) {
   669  	if tracing.IsEnabled() {
   670  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListForCluster")
   671  		defer func() {
   672  			sc := -1
   673  			if result.drc.Response.Response != nil {
   674  				sc = result.drc.Response.Response.StatusCode
   675  			}
   676  			tracing.EndSpan(ctx, sc, err)
   677  		}()
   678  	}
   679  	result.fn = client.listForClusterNextResults
   680  	req, err := client.ListForClusterPreparer(ctx, resourceGroupName, serviceName, version)
   681  	if err != nil {
   682  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", nil, "Failure preparing request")
   683  		return
   684  	}
   685  
   686  	resp, err := client.ListForClusterSender(req)
   687  	if err != nil {
   688  		result.drc.Response = autorest.Response{Response: resp}
   689  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", resp, "Failure sending request")
   690  		return
   691  	}
   692  
   693  	result.drc, err = client.ListForClusterResponder(resp)
   694  	if err != nil {
   695  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "ListForCluster", resp, "Failure responding to request")
   696  		return
   697  	}
   698  	if result.drc.hasNextLink() && result.drc.IsEmpty() {
   699  		err = result.NextWithContext(ctx)
   700  		return
   701  	}
   702  
   703  	return
   704  }
   705  
   706  // ListForClusterPreparer prepares the ListForCluster request.
   707  func (client DeploymentsClient) ListForClusterPreparer(ctx context.Context, resourceGroupName string, serviceName string, version []string) (*http.Request, error) {
   708  	pathParameters := map[string]interface{}{
   709  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   710  		"serviceName":       autorest.Encode("path", serviceName),
   711  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   712  	}
   713  
   714  	const APIVersion = "2021-09-01-preview"
   715  	queryParameters := map[string]interface{}{
   716  		"api-version": APIVersion,
   717  	}
   718  	if version != nil && len(version) > 0 {
   719  		queryParameters["version"] = version
   720  	}
   721  
   722  	preparer := autorest.CreatePreparer(
   723  		autorest.AsGet(),
   724  		autorest.WithBaseURL(client.BaseURI),
   725  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/deployments", pathParameters),
   726  		autorest.WithQueryParameters(queryParameters))
   727  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   728  }
   729  
   730  // ListForClusterSender sends the ListForCluster request. The method will close the
   731  // http.Response Body if it receives an error.
   732  func (client DeploymentsClient) ListForClusterSender(req *http.Request) (*http.Response, error) {
   733  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   734  }
   735  
   736  // ListForClusterResponder handles the response to the ListForCluster request. The method always
   737  // closes the http.Response Body.
   738  func (client DeploymentsClient) ListForClusterResponder(resp *http.Response) (result DeploymentResourceCollection, err error) {
   739  	err = autorest.Respond(
   740  		resp,
   741  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   742  		autorest.ByUnmarshallingJSON(&result),
   743  		autorest.ByClosing())
   744  	result.Response = autorest.Response{Response: resp}
   745  	return
   746  }
   747  
   748  // listForClusterNextResults retrieves the next set of results, if any.
   749  func (client DeploymentsClient) listForClusterNextResults(ctx context.Context, lastResults DeploymentResourceCollection) (result DeploymentResourceCollection, err error) {
   750  	req, err := lastResults.deploymentResourceCollectionPreparer(ctx)
   751  	if err != nil {
   752  		return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", nil, "Failure preparing next results request")
   753  	}
   754  	if req == nil {
   755  		return
   756  	}
   757  	resp, err := client.ListForClusterSender(req)
   758  	if err != nil {
   759  		result.Response = autorest.Response{Response: resp}
   760  		return result, autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", resp, "Failure sending next results request")
   761  	}
   762  	result, err = client.ListForClusterResponder(resp)
   763  	if err != nil {
   764  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "listForClusterNextResults", resp, "Failure responding to next results request")
   765  	}
   766  	return
   767  }
   768  
   769  // ListForClusterComplete enumerates all values, automatically crossing page boundaries as required.
   770  func (client DeploymentsClient) ListForClusterComplete(ctx context.Context, resourceGroupName string, serviceName string, version []string) (result DeploymentResourceCollectionIterator, err error) {
   771  	if tracing.IsEnabled() {
   772  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.ListForCluster")
   773  		defer func() {
   774  			sc := -1
   775  			if result.Response().Response.Response != nil {
   776  				sc = result.page.Response().Response.Response.StatusCode
   777  			}
   778  			tracing.EndSpan(ctx, sc, err)
   779  		}()
   780  	}
   781  	result.page, err = client.ListForCluster(ctx, resourceGroupName, serviceName, version)
   782  	return
   783  }
   784  
   785  // Restart restart the deployment.
   786  // Parameters:
   787  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   788  // from the Azure Resource Manager API or the portal.
   789  // serviceName - the name of the Service resource.
   790  // appName - the name of the App resource.
   791  // deploymentName - the name of the Deployment resource.
   792  func (client DeploymentsClient) Restart(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsRestartFuture, err error) {
   793  	if tracing.IsEnabled() {
   794  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Restart")
   795  		defer func() {
   796  			sc := -1
   797  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   798  				sc = result.FutureAPI.Response().StatusCode
   799  			}
   800  			tracing.EndSpan(ctx, sc, err)
   801  		}()
   802  	}
   803  	req, err := client.RestartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName)
   804  	if err != nil {
   805  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", nil, "Failure preparing request")
   806  		return
   807  	}
   808  
   809  	result, err = client.RestartSender(req)
   810  	if err != nil {
   811  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Restart", result.Response(), "Failure sending request")
   812  		return
   813  	}
   814  
   815  	return
   816  }
   817  
   818  // RestartPreparer prepares the Restart request.
   819  func (client DeploymentsClient) RestartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) {
   820  	pathParameters := map[string]interface{}{
   821  		"appName":           autorest.Encode("path", appName),
   822  		"deploymentName":    autorest.Encode("path", deploymentName),
   823  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   824  		"serviceName":       autorest.Encode("path", serviceName),
   825  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   826  	}
   827  
   828  	const APIVersion = "2021-09-01-preview"
   829  	queryParameters := map[string]interface{}{
   830  		"api-version": APIVersion,
   831  	}
   832  
   833  	preparer := autorest.CreatePreparer(
   834  		autorest.AsPost(),
   835  		autorest.WithBaseURL(client.BaseURI),
   836  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/restart", pathParameters),
   837  		autorest.WithQueryParameters(queryParameters))
   838  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   839  }
   840  
   841  // RestartSender sends the Restart request. The method will close the
   842  // http.Response Body if it receives an error.
   843  func (client DeploymentsClient) RestartSender(req *http.Request) (future DeploymentsRestartFuture, err error) {
   844  	var resp *http.Response
   845  	future.FutureAPI = &azure.Future{}
   846  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   847  	if err != nil {
   848  		return
   849  	}
   850  	var azf azure.Future
   851  	azf, err = azure.NewFutureFromResponse(resp)
   852  	future.FutureAPI = &azf
   853  	future.Result = future.result
   854  	return
   855  }
   856  
   857  // RestartResponder handles the response to the Restart request. The method always
   858  // closes the http.Response Body.
   859  func (client DeploymentsClient) RestartResponder(resp *http.Response) (result autorest.Response, err error) {
   860  	err = autorest.Respond(
   861  		resp,
   862  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   863  		autorest.ByClosing())
   864  	result.Response = resp
   865  	return
   866  }
   867  
   868  // Start start the deployment.
   869  // Parameters:
   870  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   871  // from the Azure Resource Manager API or the portal.
   872  // serviceName - the name of the Service resource.
   873  // appName - the name of the App resource.
   874  // deploymentName - the name of the Deployment resource.
   875  func (client DeploymentsClient) Start(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStartFuture, err error) {
   876  	if tracing.IsEnabled() {
   877  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Start")
   878  		defer func() {
   879  			sc := -1
   880  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   881  				sc = result.FutureAPI.Response().StatusCode
   882  			}
   883  			tracing.EndSpan(ctx, sc, err)
   884  		}()
   885  	}
   886  	req, err := client.StartPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName)
   887  	if err != nil {
   888  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", nil, "Failure preparing request")
   889  		return
   890  	}
   891  
   892  	result, err = client.StartSender(req)
   893  	if err != nil {
   894  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Start", result.Response(), "Failure sending request")
   895  		return
   896  	}
   897  
   898  	return
   899  }
   900  
   901  // StartPreparer prepares the Start request.
   902  func (client DeploymentsClient) StartPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) {
   903  	pathParameters := map[string]interface{}{
   904  		"appName":           autorest.Encode("path", appName),
   905  		"deploymentName":    autorest.Encode("path", deploymentName),
   906  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   907  		"serviceName":       autorest.Encode("path", serviceName),
   908  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   909  	}
   910  
   911  	const APIVersion = "2021-09-01-preview"
   912  	queryParameters := map[string]interface{}{
   913  		"api-version": APIVersion,
   914  	}
   915  
   916  	preparer := autorest.CreatePreparer(
   917  		autorest.AsPost(),
   918  		autorest.WithBaseURL(client.BaseURI),
   919  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/start", pathParameters),
   920  		autorest.WithQueryParameters(queryParameters))
   921  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   922  }
   923  
   924  // StartSender sends the Start request. The method will close the
   925  // http.Response Body if it receives an error.
   926  func (client DeploymentsClient) StartSender(req *http.Request) (future DeploymentsStartFuture, err error) {
   927  	var resp *http.Response
   928  	future.FutureAPI = &azure.Future{}
   929  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   930  	if err != nil {
   931  		return
   932  	}
   933  	var azf azure.Future
   934  	azf, err = azure.NewFutureFromResponse(resp)
   935  	future.FutureAPI = &azf
   936  	future.Result = future.result
   937  	return
   938  }
   939  
   940  // StartResponder handles the response to the Start request. The method always
   941  // closes the http.Response Body.
   942  func (client DeploymentsClient) StartResponder(resp *http.Response) (result autorest.Response, err error) {
   943  	err = autorest.Respond(
   944  		resp,
   945  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   946  		autorest.ByClosing())
   947  	result.Response = resp
   948  	return
   949  }
   950  
   951  // StartJFR start JFR
   952  // Parameters:
   953  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
   954  // from the Azure Resource Manager API or the portal.
   955  // serviceName - the name of the Service resource.
   956  // appName - the name of the App resource.
   957  // deploymentName - the name of the Deployment resource.
   958  // diagnosticParameters - parameters for the diagnostic operation
   959  func (client DeploymentsClient) StartJFR(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (result DeploymentsStartJFRFuture, err error) {
   960  	if tracing.IsEnabled() {
   961  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.StartJFR")
   962  		defer func() {
   963  			sc := -1
   964  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   965  				sc = result.FutureAPI.Response().StatusCode
   966  			}
   967  			tracing.EndSpan(ctx, sc, err)
   968  		}()
   969  	}
   970  	req, err := client.StartJFRPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters)
   971  	if err != nil {
   972  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "StartJFR", nil, "Failure preparing request")
   973  		return
   974  	}
   975  
   976  	result, err = client.StartJFRSender(req)
   977  	if err != nil {
   978  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "StartJFR", result.Response(), "Failure sending request")
   979  		return
   980  	}
   981  
   982  	return
   983  }
   984  
   985  // StartJFRPreparer prepares the StartJFR request.
   986  func (client DeploymentsClient) StartJFRPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters) (*http.Request, error) {
   987  	pathParameters := map[string]interface{}{
   988  		"appName":           autorest.Encode("path", appName),
   989  		"deploymentName":    autorest.Encode("path", deploymentName),
   990  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   991  		"serviceName":       autorest.Encode("path", serviceName),
   992  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   993  	}
   994  
   995  	const APIVersion = "2021-09-01-preview"
   996  	queryParameters := map[string]interface{}{
   997  		"api-version": APIVersion,
   998  	}
   999  
  1000  	preparer := autorest.CreatePreparer(
  1001  		autorest.AsContentType("application/json; charset=utf-8"),
  1002  		autorest.AsPost(),
  1003  		autorest.WithBaseURL(client.BaseURI),
  1004  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR", pathParameters),
  1005  		autorest.WithJSON(diagnosticParameters),
  1006  		autorest.WithQueryParameters(queryParameters))
  1007  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1008  }
  1009  
  1010  // StartJFRSender sends the StartJFR request. The method will close the
  1011  // http.Response Body if it receives an error.
  1012  func (client DeploymentsClient) StartJFRSender(req *http.Request) (future DeploymentsStartJFRFuture, err error) {
  1013  	var resp *http.Response
  1014  	future.FutureAPI = &azure.Future{}
  1015  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1016  	if err != nil {
  1017  		return
  1018  	}
  1019  	var azf azure.Future
  1020  	azf, err = azure.NewFutureFromResponse(resp)
  1021  	future.FutureAPI = &azf
  1022  	future.Result = future.result
  1023  	return
  1024  }
  1025  
  1026  // StartJFRResponder handles the response to the StartJFR request. The method always
  1027  // closes the http.Response Body.
  1028  func (client DeploymentsClient) StartJFRResponder(resp *http.Response) (result autorest.Response, err error) {
  1029  	err = autorest.Respond(
  1030  		resp,
  1031  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1032  		autorest.ByClosing())
  1033  	result.Response = resp
  1034  	return
  1035  }
  1036  
  1037  // Stop stop the deployment.
  1038  // Parameters:
  1039  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
  1040  // from the Azure Resource Manager API or the portal.
  1041  // serviceName - the name of the Service resource.
  1042  // appName - the name of the App resource.
  1043  // deploymentName - the name of the Deployment resource.
  1044  func (client DeploymentsClient) Stop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (result DeploymentsStopFuture, err error) {
  1045  	if tracing.IsEnabled() {
  1046  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Stop")
  1047  		defer func() {
  1048  			sc := -1
  1049  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1050  				sc = result.FutureAPI.Response().StatusCode
  1051  			}
  1052  			tracing.EndSpan(ctx, sc, err)
  1053  		}()
  1054  	}
  1055  	req, err := client.StopPreparer(ctx, resourceGroupName, serviceName, appName, deploymentName)
  1056  	if err != nil {
  1057  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", nil, "Failure preparing request")
  1058  		return
  1059  	}
  1060  
  1061  	result, err = client.StopSender(req)
  1062  	if err != nil {
  1063  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Stop", result.Response(), "Failure sending request")
  1064  		return
  1065  	}
  1066  
  1067  	return
  1068  }
  1069  
  1070  // StopPreparer prepares the Stop request.
  1071  func (client DeploymentsClient) StopPreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string) (*http.Request, error) {
  1072  	pathParameters := map[string]interface{}{
  1073  		"appName":           autorest.Encode("path", appName),
  1074  		"deploymentName":    autorest.Encode("path", deploymentName),
  1075  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1076  		"serviceName":       autorest.Encode("path", serviceName),
  1077  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1078  	}
  1079  
  1080  	const APIVersion = "2021-09-01-preview"
  1081  	queryParameters := map[string]interface{}{
  1082  		"api-version": APIVersion,
  1083  	}
  1084  
  1085  	preparer := autorest.CreatePreparer(
  1086  		autorest.AsPost(),
  1087  		autorest.WithBaseURL(client.BaseURI),
  1088  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/stop", pathParameters),
  1089  		autorest.WithQueryParameters(queryParameters))
  1090  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1091  }
  1092  
  1093  // StopSender sends the Stop request. The method will close the
  1094  // http.Response Body if it receives an error.
  1095  func (client DeploymentsClient) StopSender(req *http.Request) (future DeploymentsStopFuture, err error) {
  1096  	var resp *http.Response
  1097  	future.FutureAPI = &azure.Future{}
  1098  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1099  	if err != nil {
  1100  		return
  1101  	}
  1102  	var azf azure.Future
  1103  	azf, err = azure.NewFutureFromResponse(resp)
  1104  	future.FutureAPI = &azf
  1105  	future.Result = future.result
  1106  	return
  1107  }
  1108  
  1109  // StopResponder handles the response to the Stop request. The method always
  1110  // closes the http.Response Body.
  1111  func (client DeploymentsClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
  1112  	err = autorest.Respond(
  1113  		resp,
  1114  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1115  		autorest.ByClosing())
  1116  	result.Response = resp
  1117  	return
  1118  }
  1119  
  1120  // Update operation to update an exiting Deployment.
  1121  // Parameters:
  1122  // resourceGroupName - the name of the resource group that contains the resource. You can obtain this value
  1123  // from the Azure Resource Manager API or the portal.
  1124  // serviceName - the name of the Service resource.
  1125  // appName - the name of the App resource.
  1126  // deploymentName - the name of the Deployment resource.
  1127  // deploymentResource - parameters for the update operation
  1128  func (client DeploymentsClient) Update(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (result DeploymentsUpdateFuture, err error) {
  1129  	if tracing.IsEnabled() {
  1130  		ctx = tracing.StartSpan(ctx, fqdn+"/DeploymentsClient.Update")
  1131  		defer func() {
  1132  			sc := -1
  1133  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
  1134  				sc = result.FutureAPI.Response().StatusCode
  1135  			}
  1136  			tracing.EndSpan(ctx, sc, err)
  1137  		}()
  1138  	}
  1139  	req, err := client.UpdatePreparer(ctx, resourceGroupName, serviceName, appName, deploymentName, deploymentResource)
  1140  	if err != nil {
  1141  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", nil, "Failure preparing request")
  1142  		return
  1143  	}
  1144  
  1145  	result, err = client.UpdateSender(req)
  1146  	if err != nil {
  1147  		err = autorest.NewErrorWithError(err, "appplatform.DeploymentsClient", "Update", result.Response(), "Failure sending request")
  1148  		return
  1149  	}
  1150  
  1151  	return
  1152  }
  1153  
  1154  // UpdatePreparer prepares the Update request.
  1155  func (client DeploymentsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, deploymentResource DeploymentResource) (*http.Request, error) {
  1156  	pathParameters := map[string]interface{}{
  1157  		"appName":           autorest.Encode("path", appName),
  1158  		"deploymentName":    autorest.Encode("path", deploymentName),
  1159  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
  1160  		"serviceName":       autorest.Encode("path", serviceName),
  1161  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
  1162  	}
  1163  
  1164  	const APIVersion = "2021-09-01-preview"
  1165  	queryParameters := map[string]interface{}{
  1166  		"api-version": APIVersion,
  1167  	}
  1168  
  1169  	preparer := autorest.CreatePreparer(
  1170  		autorest.AsContentType("application/json; charset=utf-8"),
  1171  		autorest.AsPatch(),
  1172  		autorest.WithBaseURL(client.BaseURI),
  1173  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}", pathParameters),
  1174  		autorest.WithJSON(deploymentResource),
  1175  		autorest.WithQueryParameters(queryParameters))
  1176  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
  1177  }
  1178  
  1179  // UpdateSender sends the Update request. The method will close the
  1180  // http.Response Body if it receives an error.
  1181  func (client DeploymentsClient) UpdateSender(req *http.Request) (future DeploymentsUpdateFuture, err error) {
  1182  	var resp *http.Response
  1183  	future.FutureAPI = &azure.Future{}
  1184  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
  1185  	if err != nil {
  1186  		return
  1187  	}
  1188  	var azf azure.Future
  1189  	azf, err = azure.NewFutureFromResponse(resp)
  1190  	future.FutureAPI = &azf
  1191  	future.Result = future.result
  1192  	return
  1193  }
  1194  
  1195  // UpdateResponder handles the response to the Update request. The method always
  1196  // closes the http.Response Body.
  1197  func (client DeploymentsClient) UpdateResponder(resp *http.Response) (result DeploymentResource, err error) {
  1198  	err = autorest.Respond(
  1199  		resp,
  1200  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
  1201  		autorest.ByUnmarshallingJSON(&result),
  1202  		autorest.ByClosing())
  1203  	result.Response = autorest.Response{Response: resp}
  1204  	return
  1205  }
  1206  

View as plain text