...

Source file src/github.com/Azure/azure-sdk-for-go/services/preview/solutions/mgmt/2021-02-01-preview/managedapplications/applicationdefinitions.go

Documentation: github.com/Azure/azure-sdk-for-go/services/preview/solutions/mgmt/2021-02-01-preview/managedapplications

     1  package managedapplications
     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/autorest/validation"
    14  	"github.com/Azure/go-autorest/tracing"
    15  	"net/http"
    16  )
    17  
    18  // ApplicationDefinitionsClient is the ARM applications
    19  type ApplicationDefinitionsClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewApplicationDefinitionsClient creates an instance of the ApplicationDefinitionsClient client.
    24  func NewApplicationDefinitionsClient(subscriptionID string) ApplicationDefinitionsClient {
    25  	return NewApplicationDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewApplicationDefinitionsClientWithBaseURI creates an instance of the ApplicationDefinitionsClient client using a
    29  // custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds,
    30  // Azure stack).
    31  func NewApplicationDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) ApplicationDefinitionsClient {
    32  	return ApplicationDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)}
    33  }
    34  
    35  // CreateOrUpdate creates or updates a managed application definition.
    36  // Parameters:
    37  // resourceGroupName - the name of the resource group. The name is case insensitive.
    38  // applicationDefinitionName - the name of the managed application definition.
    39  // parameters - parameters supplied to the create or update an managed application definition.
    40  func (client ApplicationDefinitionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (result ApplicationDefinition, err error) {
    41  	if tracing.IsEnabled() {
    42  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.CreateOrUpdate")
    43  		defer func() {
    44  			sc := -1
    45  			if result.Response.Response != nil {
    46  				sc = result.Response.Response.StatusCode
    47  			}
    48  			tracing.EndSpan(ctx, sc, err)
    49  		}()
    50  	}
    51  	if err := validation.Validate([]validation.Validation{
    52  		{TargetValue: client.SubscriptionID,
    53  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
    54  		{TargetValue: resourceGroupName,
    55  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
    56  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
    57  		{TargetValue: applicationDefinitionName,
    58  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
    59  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
    60  		{TargetValue: parameters,
    61  			Constraints: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties", Name: validation.Null, Rule: true,
    62  				Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy", Name: validation.Null, Rule: false,
    63  					Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy.NotificationEndpoints", Name: validation.Null, Rule: true, Chain: nil}}},
    64  				}}}}}); err != nil {
    65  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", err.Error())
    66  	}
    67  
    68  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, applicationDefinitionName, parameters)
    69  	if err != nil {
    70  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", nil, "Failure preparing request")
    71  		return
    72  	}
    73  
    74  	resp, err := client.CreateOrUpdateSender(req)
    75  	if err != nil {
    76  		result.Response = autorest.Response{Response: resp}
    77  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", resp, "Failure sending request")
    78  		return
    79  	}
    80  
    81  	result, err = client.CreateOrUpdateResponder(resp)
    82  	if err != nil {
    83  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdate", resp, "Failure responding to request")
    84  		return
    85  	}
    86  
    87  	return
    88  }
    89  
    90  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
    91  func (client ApplicationDefinitionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (*http.Request, error) {
    92  	pathParameters := map[string]interface{}{
    93  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
    94  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
    95  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
    96  	}
    97  
    98  	const APIVersion = "2021-02-01-preview"
    99  	queryParameters := map[string]interface{}{
   100  		"api-version": APIVersion,
   101  	}
   102  
   103  	preparer := autorest.CreatePreparer(
   104  		autorest.AsContentType("application/json; charset=utf-8"),
   105  		autorest.AsPut(),
   106  		autorest.WithBaseURL(client.BaseURI),
   107  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   108  		autorest.WithJSON(parameters),
   109  		autorest.WithQueryParameters(queryParameters))
   110  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   111  }
   112  
   113  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
   114  // http.Response Body if it receives an error.
   115  func (client ApplicationDefinitionsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
   116  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   117  }
   118  
   119  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
   120  // closes the http.Response Body.
   121  func (client ApplicationDefinitionsClient) CreateOrUpdateResponder(resp *http.Response) (result ApplicationDefinition, err error) {
   122  	err = autorest.Respond(
   123  		resp,
   124  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   125  		autorest.ByUnmarshallingJSON(&result),
   126  		autorest.ByClosing())
   127  	result.Response = autorest.Response{Response: resp}
   128  	return
   129  }
   130  
   131  // CreateOrUpdateByID creates or updates managed application definition.
   132  // Parameters:
   133  // resourceGroupName - the name of the resource group. The name is case insensitive.
   134  // applicationDefinitionName - the name of the managed application definition.
   135  // parameters - parameters supplied to the create or update a managed application definition.
   136  func (client ApplicationDefinitionsClient) CreateOrUpdateByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (result ApplicationDefinition, err error) {
   137  	if tracing.IsEnabled() {
   138  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.CreateOrUpdateByID")
   139  		defer func() {
   140  			sc := -1
   141  			if result.Response.Response != nil {
   142  				sc = result.Response.Response.StatusCode
   143  			}
   144  			tracing.EndSpan(ctx, sc, err)
   145  		}()
   146  	}
   147  	if err := validation.Validate([]validation.Validation{
   148  		{TargetValue: resourceGroupName,
   149  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   150  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   151  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   152  		{TargetValue: applicationDefinitionName,
   153  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   154  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   155  		{TargetValue: client.SubscriptionID,
   156  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   157  		{TargetValue: parameters,
   158  			Constraints: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties", Name: validation.Null, Rule: true,
   159  				Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy", Name: validation.Null, Rule: false,
   160  					Chain: []validation.Constraint{{Target: "parameters.ApplicationDefinitionProperties.NotificationPolicy.NotificationEndpoints", Name: validation.Null, Rule: true, Chain: nil}}},
   161  				}}}}}); err != nil {
   162  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", err.Error())
   163  	}
   164  
   165  	req, err := client.CreateOrUpdateByIDPreparer(ctx, resourceGroupName, applicationDefinitionName, parameters)
   166  	if err != nil {
   167  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", nil, "Failure preparing request")
   168  		return
   169  	}
   170  
   171  	resp, err := client.CreateOrUpdateByIDSender(req)
   172  	if err != nil {
   173  		result.Response = autorest.Response{Response: resp}
   174  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", resp, "Failure sending request")
   175  		return
   176  	}
   177  
   178  	result, err = client.CreateOrUpdateByIDResponder(resp)
   179  	if err != nil {
   180  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "CreateOrUpdateByID", resp, "Failure responding to request")
   181  		return
   182  	}
   183  
   184  	return
   185  }
   186  
   187  // CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request.
   188  func (client ApplicationDefinitionsClient) CreateOrUpdateByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinition) (*http.Request, error) {
   189  	pathParameters := map[string]interface{}{
   190  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
   191  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   192  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   193  	}
   194  
   195  	const APIVersion = "2021-02-01-preview"
   196  	queryParameters := map[string]interface{}{
   197  		"api-version": APIVersion,
   198  	}
   199  
   200  	preparer := autorest.CreatePreparer(
   201  		autorest.AsContentType("application/json; charset=utf-8"),
   202  		autorest.AsPut(),
   203  		autorest.WithBaseURL(client.BaseURI),
   204  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   205  		autorest.WithJSON(parameters),
   206  		autorest.WithQueryParameters(queryParameters))
   207  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   208  }
   209  
   210  // CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the
   211  // http.Response Body if it receives an error.
   212  func (client ApplicationDefinitionsClient) CreateOrUpdateByIDSender(req *http.Request) (*http.Response, error) {
   213  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   214  }
   215  
   216  // CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always
   217  // closes the http.Response Body.
   218  func (client ApplicationDefinitionsClient) CreateOrUpdateByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) {
   219  	err = autorest.Respond(
   220  		resp,
   221  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
   222  		autorest.ByUnmarshallingJSON(&result),
   223  		autorest.ByClosing())
   224  	result.Response = autorest.Response{Response: resp}
   225  	return
   226  }
   227  
   228  // Delete deletes the managed application definition.
   229  // Parameters:
   230  // resourceGroupName - the name of the resource group. The name is case insensitive.
   231  // applicationDefinitionName - the name of the managed application definition.
   232  func (client ApplicationDefinitionsClient) Delete(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result autorest.Response, err error) {
   233  	if tracing.IsEnabled() {
   234  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.Delete")
   235  		defer func() {
   236  			sc := -1
   237  			if result.Response != nil {
   238  				sc = result.Response.StatusCode
   239  			}
   240  			tracing.EndSpan(ctx, sc, err)
   241  		}()
   242  	}
   243  	if err := validation.Validate([]validation.Validation{
   244  		{TargetValue: client.SubscriptionID,
   245  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   246  		{TargetValue: resourceGroupName,
   247  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   248  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   249  		{TargetValue: applicationDefinitionName,
   250  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   251  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
   252  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "Delete", err.Error())
   253  	}
   254  
   255  	req, err := client.DeletePreparer(ctx, resourceGroupName, applicationDefinitionName)
   256  	if err != nil {
   257  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Delete", nil, "Failure preparing request")
   258  		return
   259  	}
   260  
   261  	resp, err := client.DeleteSender(req)
   262  	if err != nil {
   263  		result.Response = resp
   264  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Delete", resp, "Failure sending request")
   265  		return
   266  	}
   267  
   268  	result, err = client.DeleteResponder(resp)
   269  	if err != nil {
   270  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Delete", resp, "Failure responding to request")
   271  		return
   272  	}
   273  
   274  	return
   275  }
   276  
   277  // DeletePreparer prepares the Delete request.
   278  func (client ApplicationDefinitionsClient) DeletePreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) {
   279  	pathParameters := map[string]interface{}{
   280  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
   281  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   282  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   283  	}
   284  
   285  	const APIVersion = "2021-02-01-preview"
   286  	queryParameters := map[string]interface{}{
   287  		"api-version": APIVersion,
   288  	}
   289  
   290  	preparer := autorest.CreatePreparer(
   291  		autorest.AsDelete(),
   292  		autorest.WithBaseURL(client.BaseURI),
   293  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   294  		autorest.WithQueryParameters(queryParameters))
   295  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   296  }
   297  
   298  // DeleteSender sends the Delete request. The method will close the
   299  // http.Response Body if it receives an error.
   300  func (client ApplicationDefinitionsClient) DeleteSender(req *http.Request) (*http.Response, error) {
   301  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   302  }
   303  
   304  // DeleteResponder handles the response to the Delete request. The method always
   305  // closes the http.Response Body.
   306  func (client ApplicationDefinitionsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   307  	err = autorest.Respond(
   308  		resp,
   309  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   310  		autorest.ByClosing())
   311  	result.Response = resp
   312  	return
   313  }
   314  
   315  // DeleteByID deletes the managed application definition.
   316  // Parameters:
   317  // resourceGroupName - the name of the resource group. The name is case insensitive.
   318  // applicationDefinitionName - the name of the managed application definition.
   319  func (client ApplicationDefinitionsClient) DeleteByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result autorest.Response, err error) {
   320  	if tracing.IsEnabled() {
   321  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.DeleteByID")
   322  		defer func() {
   323  			sc := -1
   324  			if result.Response != nil {
   325  				sc = result.Response.StatusCode
   326  			}
   327  			tracing.EndSpan(ctx, sc, err)
   328  		}()
   329  	}
   330  	if err := validation.Validate([]validation.Validation{
   331  		{TargetValue: resourceGroupName,
   332  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   333  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   334  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   335  		{TargetValue: applicationDefinitionName,
   336  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   337  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   338  		{TargetValue: client.SubscriptionID,
   339  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   340  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "DeleteByID", err.Error())
   341  	}
   342  
   343  	req, err := client.DeleteByIDPreparer(ctx, resourceGroupName, applicationDefinitionName)
   344  	if err != nil {
   345  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", nil, "Failure preparing request")
   346  		return
   347  	}
   348  
   349  	resp, err := client.DeleteByIDSender(req)
   350  	if err != nil {
   351  		result.Response = resp
   352  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", resp, "Failure sending request")
   353  		return
   354  	}
   355  
   356  	result, err = client.DeleteByIDResponder(resp)
   357  	if err != nil {
   358  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "DeleteByID", resp, "Failure responding to request")
   359  		return
   360  	}
   361  
   362  	return
   363  }
   364  
   365  // DeleteByIDPreparer prepares the DeleteByID request.
   366  func (client ApplicationDefinitionsClient) DeleteByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) {
   367  	pathParameters := map[string]interface{}{
   368  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
   369  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   370  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   371  	}
   372  
   373  	const APIVersion = "2021-02-01-preview"
   374  	queryParameters := map[string]interface{}{
   375  		"api-version": APIVersion,
   376  	}
   377  
   378  	preparer := autorest.CreatePreparer(
   379  		autorest.AsDelete(),
   380  		autorest.WithBaseURL(client.BaseURI),
   381  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   382  		autorest.WithQueryParameters(queryParameters))
   383  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   384  }
   385  
   386  // DeleteByIDSender sends the DeleteByID request. The method will close the
   387  // http.Response Body if it receives an error.
   388  func (client ApplicationDefinitionsClient) DeleteByIDSender(req *http.Request) (*http.Response, error) {
   389  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   390  }
   391  
   392  // DeleteByIDResponder handles the response to the DeleteByID request. The method always
   393  // closes the http.Response Body.
   394  func (client ApplicationDefinitionsClient) DeleteByIDResponder(resp *http.Response) (result autorest.Response, err error) {
   395  	err = autorest.Respond(
   396  		resp,
   397  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
   398  		autorest.ByClosing())
   399  	result.Response = resp
   400  	return
   401  }
   402  
   403  // Get gets the managed application definition.
   404  // Parameters:
   405  // resourceGroupName - the name of the resource group. The name is case insensitive.
   406  // applicationDefinitionName - the name of the managed application definition.
   407  func (client ApplicationDefinitionsClient) Get(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinition, err error) {
   408  	if tracing.IsEnabled() {
   409  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.Get")
   410  		defer func() {
   411  			sc := -1
   412  			if result.Response.Response != nil {
   413  				sc = result.Response.Response.StatusCode
   414  			}
   415  			tracing.EndSpan(ctx, sc, err)
   416  		}()
   417  	}
   418  	if err := validation.Validate([]validation.Validation{
   419  		{TargetValue: client.SubscriptionID,
   420  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   421  		{TargetValue: resourceGroupName,
   422  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   423  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   424  		{TargetValue: applicationDefinitionName,
   425  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   426  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
   427  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "Get", err.Error())
   428  	}
   429  
   430  	req, err := client.GetPreparer(ctx, resourceGroupName, applicationDefinitionName)
   431  	if err != nil {
   432  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", nil, "Failure preparing request")
   433  		return
   434  	}
   435  
   436  	resp, err := client.GetSender(req)
   437  	if err != nil {
   438  		result.Response = autorest.Response{Response: resp}
   439  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", resp, "Failure sending request")
   440  		return
   441  	}
   442  
   443  	result, err = client.GetResponder(resp)
   444  	if err != nil {
   445  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Get", resp, "Failure responding to request")
   446  		return
   447  	}
   448  
   449  	return
   450  }
   451  
   452  // GetPreparer prepares the Get request.
   453  func (client ApplicationDefinitionsClient) GetPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) {
   454  	pathParameters := map[string]interface{}{
   455  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
   456  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   457  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   458  	}
   459  
   460  	const APIVersion = "2021-02-01-preview"
   461  	queryParameters := map[string]interface{}{
   462  		"api-version": APIVersion,
   463  	}
   464  
   465  	preparer := autorest.CreatePreparer(
   466  		autorest.AsGet(),
   467  		autorest.WithBaseURL(client.BaseURI),
   468  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   469  		autorest.WithQueryParameters(queryParameters))
   470  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   471  }
   472  
   473  // GetSender sends the Get request. The method will close the
   474  // http.Response Body if it receives an error.
   475  func (client ApplicationDefinitionsClient) GetSender(req *http.Request) (*http.Response, error) {
   476  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   477  }
   478  
   479  // GetResponder handles the response to the Get request. The method always
   480  // closes the http.Response Body.
   481  func (client ApplicationDefinitionsClient) GetResponder(resp *http.Response) (result ApplicationDefinition, err error) {
   482  	err = autorest.Respond(
   483  		resp,
   484  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound),
   485  		autorest.ByUnmarshallingJSON(&result),
   486  		autorest.ByClosing())
   487  	result.Response = autorest.Response{Response: resp}
   488  	return
   489  }
   490  
   491  // GetByID gets the managed application definition.
   492  // Parameters:
   493  // resourceGroupName - the name of the resource group. The name is case insensitive.
   494  // applicationDefinitionName - the name of the managed application definition.
   495  func (client ApplicationDefinitionsClient) GetByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (result ApplicationDefinition, err error) {
   496  	if tracing.IsEnabled() {
   497  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.GetByID")
   498  		defer func() {
   499  			sc := -1
   500  			if result.Response.Response != nil {
   501  				sc = result.Response.Response.StatusCode
   502  			}
   503  			tracing.EndSpan(ctx, sc, err)
   504  		}()
   505  	}
   506  	if err := validation.Validate([]validation.Validation{
   507  		{TargetValue: resourceGroupName,
   508  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   509  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
   510  				{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}},
   511  		{TargetValue: applicationDefinitionName,
   512  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   513  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
   514  		{TargetValue: client.SubscriptionID,
   515  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   516  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "GetByID", err.Error())
   517  	}
   518  
   519  	req, err := client.GetByIDPreparer(ctx, resourceGroupName, applicationDefinitionName)
   520  	if err != nil {
   521  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", nil, "Failure preparing request")
   522  		return
   523  	}
   524  
   525  	resp, err := client.GetByIDSender(req)
   526  	if err != nil {
   527  		result.Response = autorest.Response{Response: resp}
   528  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", resp, "Failure sending request")
   529  		return
   530  	}
   531  
   532  	result, err = client.GetByIDResponder(resp)
   533  	if err != nil {
   534  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "GetByID", resp, "Failure responding to request")
   535  		return
   536  	}
   537  
   538  	return
   539  }
   540  
   541  // GetByIDPreparer prepares the GetByID request.
   542  func (client ApplicationDefinitionsClient) GetByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string) (*http.Request, error) {
   543  	pathParameters := map[string]interface{}{
   544  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
   545  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   546  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   547  	}
   548  
   549  	const APIVersion = "2021-02-01-preview"
   550  	queryParameters := map[string]interface{}{
   551  		"api-version": APIVersion,
   552  	}
   553  
   554  	preparer := autorest.CreatePreparer(
   555  		autorest.AsGet(),
   556  		autorest.WithBaseURL(client.BaseURI),
   557  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   558  		autorest.WithQueryParameters(queryParameters))
   559  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   560  }
   561  
   562  // GetByIDSender sends the GetByID request. The method will close the
   563  // http.Response Body if it receives an error.
   564  func (client ApplicationDefinitionsClient) GetByIDSender(req *http.Request) (*http.Response, error) {
   565  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   566  }
   567  
   568  // GetByIDResponder handles the response to the GetByID request. The method always
   569  // closes the http.Response Body.
   570  func (client ApplicationDefinitionsClient) GetByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) {
   571  	err = autorest.Respond(
   572  		resp,
   573  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNotFound),
   574  		autorest.ByUnmarshallingJSON(&result),
   575  		autorest.ByClosing())
   576  	result.Response = autorest.Response{Response: resp}
   577  	return
   578  }
   579  
   580  // ListByResourceGroup lists the managed application definitions in a resource group.
   581  // Parameters:
   582  // resourceGroupName - the name of the resource group. The name is case insensitive.
   583  func (client ApplicationDefinitionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ApplicationDefinitionListResultPage, err error) {
   584  	if tracing.IsEnabled() {
   585  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.ListByResourceGroup")
   586  		defer func() {
   587  			sc := -1
   588  			if result.adlr.Response.Response != nil {
   589  				sc = result.adlr.Response.Response.StatusCode
   590  			}
   591  			tracing.EndSpan(ctx, sc, err)
   592  		}()
   593  	}
   594  	if err := validation.Validate([]validation.Validation{
   595  		{TargetValue: client.SubscriptionID,
   596  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   597  		{TargetValue: resourceGroupName,
   598  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   599  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   600  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", err.Error())
   601  	}
   602  
   603  	result.fn = client.listByResourceGroupNextResults
   604  	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
   605  	if err != nil {
   606  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", nil, "Failure preparing request")
   607  		return
   608  	}
   609  
   610  	resp, err := client.ListByResourceGroupSender(req)
   611  	if err != nil {
   612  		result.adlr.Response = autorest.Response{Response: resp}
   613  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", resp, "Failure sending request")
   614  		return
   615  	}
   616  
   617  	result.adlr, err = client.ListByResourceGroupResponder(resp)
   618  	if err != nil {
   619  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListByResourceGroup", resp, "Failure responding to request")
   620  		return
   621  	}
   622  	if result.adlr.hasNextLink() && result.adlr.IsEmpty() {
   623  		err = result.NextWithContext(ctx)
   624  		return
   625  	}
   626  
   627  	return
   628  }
   629  
   630  // ListByResourceGroupPreparer prepares the ListByResourceGroup request.
   631  func (client ApplicationDefinitionsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   632  	pathParameters := map[string]interface{}{
   633  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   634  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   635  	}
   636  
   637  	const APIVersion = "2021-02-01-preview"
   638  	queryParameters := map[string]interface{}{
   639  		"api-version": APIVersion,
   640  	}
   641  
   642  	preparer := autorest.CreatePreparer(
   643  		autorest.AsGet(),
   644  		autorest.WithBaseURL(client.BaseURI),
   645  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions", pathParameters),
   646  		autorest.WithQueryParameters(queryParameters))
   647  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   648  }
   649  
   650  // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
   651  // http.Response Body if it receives an error.
   652  func (client ApplicationDefinitionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
   653  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   654  }
   655  
   656  // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
   657  // closes the http.Response Body.
   658  func (client ApplicationDefinitionsClient) ListByResourceGroupResponder(resp *http.Response) (result ApplicationDefinitionListResult, err error) {
   659  	err = autorest.Respond(
   660  		resp,
   661  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   662  		autorest.ByUnmarshallingJSON(&result),
   663  		autorest.ByClosing())
   664  	result.Response = autorest.Response{Response: resp}
   665  	return
   666  }
   667  
   668  // listByResourceGroupNextResults retrieves the next set of results, if any.
   669  func (client ApplicationDefinitionsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ApplicationDefinitionListResult) (result ApplicationDefinitionListResult, err error) {
   670  	req, err := lastResults.applicationDefinitionListResultPreparer(ctx)
   671  	if err != nil {
   672  		return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
   673  	}
   674  	if req == nil {
   675  		return
   676  	}
   677  	resp, err := client.ListByResourceGroupSender(req)
   678  	if err != nil {
   679  		result.Response = autorest.Response{Response: resp}
   680  		return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
   681  	}
   682  	result, err = client.ListByResourceGroupResponder(resp)
   683  	if err != nil {
   684  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
   685  	}
   686  	return
   687  }
   688  
   689  // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
   690  func (client ApplicationDefinitionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ApplicationDefinitionListResultIterator, err error) {
   691  	if tracing.IsEnabled() {
   692  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.ListByResourceGroup")
   693  		defer func() {
   694  			sc := -1
   695  			if result.Response().Response.Response != nil {
   696  				sc = result.page.Response().Response.Response.StatusCode
   697  			}
   698  			tracing.EndSpan(ctx, sc, err)
   699  		}()
   700  	}
   701  	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
   702  	return
   703  }
   704  
   705  // ListBySubscription gets all the application definitions within a subscription.
   706  func (client ApplicationDefinitionsClient) ListBySubscription(ctx context.Context) (result ApplicationDefinitionListResultPage, err error) {
   707  	if tracing.IsEnabled() {
   708  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.ListBySubscription")
   709  		defer func() {
   710  			sc := -1
   711  			if result.adlr.Response.Response != nil {
   712  				sc = result.adlr.Response.Response.StatusCode
   713  			}
   714  			tracing.EndSpan(ctx, sc, err)
   715  		}()
   716  	}
   717  	if err := validation.Validate([]validation.Validation{
   718  		{TargetValue: client.SubscriptionID,
   719  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   720  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "ListBySubscription", err.Error())
   721  	}
   722  
   723  	result.fn = client.listBySubscriptionNextResults
   724  	req, err := client.ListBySubscriptionPreparer(ctx)
   725  	if err != nil {
   726  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListBySubscription", nil, "Failure preparing request")
   727  		return
   728  	}
   729  
   730  	resp, err := client.ListBySubscriptionSender(req)
   731  	if err != nil {
   732  		result.adlr.Response = autorest.Response{Response: resp}
   733  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListBySubscription", resp, "Failure sending request")
   734  		return
   735  	}
   736  
   737  	result.adlr, err = client.ListBySubscriptionResponder(resp)
   738  	if err != nil {
   739  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "ListBySubscription", resp, "Failure responding to request")
   740  		return
   741  	}
   742  	if result.adlr.hasNextLink() && result.adlr.IsEmpty() {
   743  		err = result.NextWithContext(ctx)
   744  		return
   745  	}
   746  
   747  	return
   748  }
   749  
   750  // ListBySubscriptionPreparer prepares the ListBySubscription request.
   751  func (client ApplicationDefinitionsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) {
   752  	pathParameters := map[string]interface{}{
   753  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   754  	}
   755  
   756  	const APIVersion = "2021-02-01-preview"
   757  	queryParameters := map[string]interface{}{
   758  		"api-version": APIVersion,
   759  	}
   760  
   761  	preparer := autorest.CreatePreparer(
   762  		autorest.AsGet(),
   763  		autorest.WithBaseURL(client.BaseURI),
   764  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/applicationDefinitions", pathParameters),
   765  		autorest.WithQueryParameters(queryParameters))
   766  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   767  }
   768  
   769  // ListBySubscriptionSender sends the ListBySubscription request. The method will close the
   770  // http.Response Body if it receives an error.
   771  func (client ApplicationDefinitionsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) {
   772  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   773  }
   774  
   775  // ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always
   776  // closes the http.Response Body.
   777  func (client ApplicationDefinitionsClient) ListBySubscriptionResponder(resp *http.Response) (result ApplicationDefinitionListResult, err error) {
   778  	err = autorest.Respond(
   779  		resp,
   780  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   781  		autorest.ByUnmarshallingJSON(&result),
   782  		autorest.ByClosing())
   783  	result.Response = autorest.Response{Response: resp}
   784  	return
   785  }
   786  
   787  // listBySubscriptionNextResults retrieves the next set of results, if any.
   788  func (client ApplicationDefinitionsClient) listBySubscriptionNextResults(ctx context.Context, lastResults ApplicationDefinitionListResult) (result ApplicationDefinitionListResult, err error) {
   789  	req, err := lastResults.applicationDefinitionListResultPreparer(ctx)
   790  	if err != nil {
   791  		return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request")
   792  	}
   793  	if req == nil {
   794  		return
   795  	}
   796  	resp, err := client.ListBySubscriptionSender(req)
   797  	if err != nil {
   798  		result.Response = autorest.Response{Response: resp}
   799  		return result, autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request")
   800  	}
   801  	result, err = client.ListBySubscriptionResponder(resp)
   802  	if err != nil {
   803  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request")
   804  	}
   805  	return
   806  }
   807  
   808  // ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required.
   809  func (client ApplicationDefinitionsClient) ListBySubscriptionComplete(ctx context.Context) (result ApplicationDefinitionListResultIterator, err error) {
   810  	if tracing.IsEnabled() {
   811  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.ListBySubscription")
   812  		defer func() {
   813  			sc := -1
   814  			if result.Response().Response.Response != nil {
   815  				sc = result.page.Response().Response.Response.StatusCode
   816  			}
   817  			tracing.EndSpan(ctx, sc, err)
   818  		}()
   819  	}
   820  	result.page, err = client.ListBySubscription(ctx)
   821  	return
   822  }
   823  
   824  // Update updates the managed application definition.
   825  // Parameters:
   826  // resourceGroupName - the name of the resource group. The name is case insensitive.
   827  // applicationDefinitionName - the name of the managed application definition.
   828  // parameters - parameters supplied to the update a managed application definition.
   829  func (client ApplicationDefinitionsClient) Update(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinitionPatchable) (result ApplicationDefinition, err error) {
   830  	if tracing.IsEnabled() {
   831  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.Update")
   832  		defer func() {
   833  			sc := -1
   834  			if result.Response.Response != nil {
   835  				sc = result.Response.Response.StatusCode
   836  			}
   837  			tracing.EndSpan(ctx, sc, err)
   838  		}()
   839  	}
   840  	if err := validation.Validate([]validation.Validation{
   841  		{TargetValue: client.SubscriptionID,
   842  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   843  		{TargetValue: resourceGroupName,
   844  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   845  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   846  		{TargetValue: applicationDefinitionName,
   847  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   848  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
   849  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "Update", err.Error())
   850  	}
   851  
   852  	req, err := client.UpdatePreparer(ctx, resourceGroupName, applicationDefinitionName, parameters)
   853  	if err != nil {
   854  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Update", nil, "Failure preparing request")
   855  		return
   856  	}
   857  
   858  	resp, err := client.UpdateSender(req)
   859  	if err != nil {
   860  		result.Response = autorest.Response{Response: resp}
   861  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Update", resp, "Failure sending request")
   862  		return
   863  	}
   864  
   865  	result, err = client.UpdateResponder(resp)
   866  	if err != nil {
   867  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "Update", resp, "Failure responding to request")
   868  		return
   869  	}
   870  
   871  	return
   872  }
   873  
   874  // UpdatePreparer prepares the Update request.
   875  func (client ApplicationDefinitionsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinitionPatchable) (*http.Request, error) {
   876  	pathParameters := map[string]interface{}{
   877  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
   878  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   879  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   880  	}
   881  
   882  	const APIVersion = "2021-02-01-preview"
   883  	queryParameters := map[string]interface{}{
   884  		"api-version": APIVersion,
   885  	}
   886  
   887  	preparer := autorest.CreatePreparer(
   888  		autorest.AsContentType("application/json; charset=utf-8"),
   889  		autorest.AsPatch(),
   890  		autorest.WithBaseURL(client.BaseURI),
   891  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   892  		autorest.WithJSON(parameters),
   893  		autorest.WithQueryParameters(queryParameters))
   894  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   895  }
   896  
   897  // UpdateSender sends the Update request. The method will close the
   898  // http.Response Body if it receives an error.
   899  func (client ApplicationDefinitionsClient) UpdateSender(req *http.Request) (*http.Response, error) {
   900  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   901  }
   902  
   903  // UpdateResponder handles the response to the Update request. The method always
   904  // closes the http.Response Body.
   905  func (client ApplicationDefinitionsClient) UpdateResponder(resp *http.Response) (result ApplicationDefinition, err error) {
   906  	err = autorest.Respond(
   907  		resp,
   908  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   909  		autorest.ByUnmarshallingJSON(&result),
   910  		autorest.ByClosing())
   911  	result.Response = autorest.Response{Response: resp}
   912  	return
   913  }
   914  
   915  // UpdateByID updates the managed application definition.
   916  // Parameters:
   917  // resourceGroupName - the name of the resource group. The name is case insensitive.
   918  // applicationDefinitionName - the name of the managed application definition.
   919  // parameters - parameters supplied to the update a managed application definition.
   920  func (client ApplicationDefinitionsClient) UpdateByID(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinitionPatchable) (result ApplicationDefinition, err error) {
   921  	if tracing.IsEnabled() {
   922  		ctx = tracing.StartSpan(ctx, fqdn+"/ApplicationDefinitionsClient.UpdateByID")
   923  		defer func() {
   924  			sc := -1
   925  			if result.Response.Response != nil {
   926  				sc = result.Response.Response.StatusCode
   927  			}
   928  			tracing.EndSpan(ctx, sc, err)
   929  		}()
   930  	}
   931  	if err := validation.Validate([]validation.Validation{
   932  		{TargetValue: client.SubscriptionID,
   933  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   934  		{TargetValue: resourceGroupName,
   935  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   936  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   937  		{TargetValue: applicationDefinitionName,
   938  			Constraints: []validation.Constraint{{Target: "applicationDefinitionName", Name: validation.MaxLength, Rule: 64, Chain: nil},
   939  				{Target: "applicationDefinitionName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
   940  		return result, validation.NewError("managedapplications.ApplicationDefinitionsClient", "UpdateByID", err.Error())
   941  	}
   942  
   943  	req, err := client.UpdateByIDPreparer(ctx, resourceGroupName, applicationDefinitionName, parameters)
   944  	if err != nil {
   945  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "UpdateByID", nil, "Failure preparing request")
   946  		return
   947  	}
   948  
   949  	resp, err := client.UpdateByIDSender(req)
   950  	if err != nil {
   951  		result.Response = autorest.Response{Response: resp}
   952  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "UpdateByID", resp, "Failure sending request")
   953  		return
   954  	}
   955  
   956  	result, err = client.UpdateByIDResponder(resp)
   957  	if err != nil {
   958  		err = autorest.NewErrorWithError(err, "managedapplications.ApplicationDefinitionsClient", "UpdateByID", resp, "Failure responding to request")
   959  		return
   960  	}
   961  
   962  	return
   963  }
   964  
   965  // UpdateByIDPreparer prepares the UpdateByID request.
   966  func (client ApplicationDefinitionsClient) UpdateByIDPreparer(ctx context.Context, resourceGroupName string, applicationDefinitionName string, parameters ApplicationDefinitionPatchable) (*http.Request, error) {
   967  	pathParameters := map[string]interface{}{
   968  		"applicationDefinitionName": autorest.Encode("path", applicationDefinitionName),
   969  		"resourceGroupName":         autorest.Encode("path", resourceGroupName),
   970  		"subscriptionId":            autorest.Encode("path", client.SubscriptionID),
   971  	}
   972  
   973  	const APIVersion = "2021-02-01-preview"
   974  	queryParameters := map[string]interface{}{
   975  		"api-version": APIVersion,
   976  	}
   977  
   978  	preparer := autorest.CreatePreparer(
   979  		autorest.AsContentType("application/json; charset=utf-8"),
   980  		autorest.AsPatch(),
   981  		autorest.WithBaseURL(client.BaseURI),
   982  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", pathParameters),
   983  		autorest.WithJSON(parameters),
   984  		autorest.WithQueryParameters(queryParameters))
   985  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   986  }
   987  
   988  // UpdateByIDSender sends the UpdateByID request. The method will close the
   989  // http.Response Body if it receives an error.
   990  func (client ApplicationDefinitionsClient) UpdateByIDSender(req *http.Request) (*http.Response, error) {
   991  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   992  }
   993  
   994  // UpdateByIDResponder handles the response to the UpdateByID request. The method always
   995  // closes the http.Response Body.
   996  func (client ApplicationDefinitionsClient) UpdateByIDResponder(resp *http.Response) (result ApplicationDefinition, err error) {
   997  	err = autorest.Respond(
   998  		resp,
   999  		azure.WithErrorUnlessStatusCode(http.StatusOK),
  1000  		autorest.ByUnmarshallingJSON(&result),
  1001  		autorest.ByClosing())
  1002  	result.Response = autorest.Response{Response: resp}
  1003  	return
  1004  }
  1005  

View as plain text