...

Source file src/github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights/favorites.go

Documentation: github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2020-02-02/insights

     1  package insights
     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  // FavoritesClient is the composite Swagger for Application Insights Management Client
    19  type FavoritesClient struct {
    20  	BaseClient
    21  }
    22  
    23  // NewFavoritesClient creates an instance of the FavoritesClient client.
    24  func NewFavoritesClient(subscriptionID string) FavoritesClient {
    25  	return NewFavoritesClientWithBaseURI(DefaultBaseURI, subscriptionID)
    26  }
    27  
    28  // NewFavoritesClientWithBaseURI creates an instance of the FavoritesClient client using a custom endpoint.  Use this
    29  // when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
    30  func NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string) FavoritesClient {
    31  	return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID)}
    32  }
    33  
    34  // Add adds a new favorites to an Application Insights component.
    35  // Parameters:
    36  // resourceGroupName - the name of the resource group. The name is case insensitive.
    37  // resourceName - the name of the Application Insights component resource.
    38  // favoriteID - the Id of a specific favorite defined in the Application Insights component
    39  // favoriteProperties - properties that need to be specified to create a new favorite and add it to an
    40  // Application Insights component.
    41  func (client FavoritesClient) Add(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) {
    42  	if tracing.IsEnabled() {
    43  		ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Add")
    44  		defer func() {
    45  			sc := -1
    46  			if result.Response.Response != nil {
    47  				sc = result.Response.Response.StatusCode
    48  			}
    49  			tracing.EndSpan(ctx, sc, err)
    50  		}()
    51  	}
    52  	if err := validation.Validate([]validation.Validation{
    53  		{TargetValue: resourceGroupName,
    54  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
    55  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
    56  		{TargetValue: client.SubscriptionID,
    57  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
    58  		return result, validation.NewError("insights.FavoritesClient", "Add", err.Error())
    59  	}
    60  
    61  	req, err := client.AddPreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties)
    62  	if err != nil {
    63  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", nil, "Failure preparing request")
    64  		return
    65  	}
    66  
    67  	resp, err := client.AddSender(req)
    68  	if err != nil {
    69  		result.Response = autorest.Response{Response: resp}
    70  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure sending request")
    71  		return
    72  	}
    73  
    74  	result, err = client.AddResponder(resp)
    75  	if err != nil {
    76  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Add", resp, "Failure responding to request")
    77  		return
    78  	}
    79  
    80  	return
    81  }
    82  
    83  // AddPreparer prepares the Add request.
    84  func (client FavoritesClient) AddPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) {
    85  	pathParameters := map[string]interface{}{
    86  		"favoriteId":        autorest.Encode("path", favoriteID),
    87  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
    88  		"resourceName":      autorest.Encode("path", resourceName),
    89  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
    90  	}
    91  
    92  	const APIVersion = "2015-05-01"
    93  	queryParameters := map[string]interface{}{
    94  		"api-version": APIVersion,
    95  	}
    96  
    97  	favoriteProperties.FavoriteID = nil
    98  	favoriteProperties.TimeModified = nil
    99  	favoriteProperties.UserID = nil
   100  	preparer := autorest.CreatePreparer(
   101  		autorest.AsContentType("application/json; charset=utf-8"),
   102  		autorest.AsPut(),
   103  		autorest.WithBaseURL(client.BaseURI),
   104  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters),
   105  		autorest.WithJSON(favoriteProperties),
   106  		autorest.WithQueryParameters(queryParameters))
   107  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   108  }
   109  
   110  // AddSender sends the Add request. The method will close the
   111  // http.Response Body if it receives an error.
   112  func (client FavoritesClient) AddSender(req *http.Request) (*http.Response, error) {
   113  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   114  }
   115  
   116  // AddResponder handles the response to the Add request. The method always
   117  // closes the http.Response Body.
   118  func (client FavoritesClient) AddResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) {
   119  	err = autorest.Respond(
   120  		resp,
   121  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   122  		autorest.ByUnmarshallingJSON(&result),
   123  		autorest.ByClosing())
   124  	result.Response = autorest.Response{Response: resp}
   125  	return
   126  }
   127  
   128  // Delete remove a favorite that is associated to an Application Insights component.
   129  // Parameters:
   130  // resourceGroupName - the name of the resource group. The name is case insensitive.
   131  // resourceName - the name of the Application Insights component resource.
   132  // favoriteID - the Id of a specific favorite defined in the Application Insights component
   133  func (client FavoritesClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result autorest.Response, err error) {
   134  	if tracing.IsEnabled() {
   135  		ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Delete")
   136  		defer func() {
   137  			sc := -1
   138  			if result.Response != nil {
   139  				sc = result.Response.StatusCode
   140  			}
   141  			tracing.EndSpan(ctx, sc, err)
   142  		}()
   143  	}
   144  	if err := validation.Validate([]validation.Validation{
   145  		{TargetValue: resourceGroupName,
   146  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   147  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   148  		{TargetValue: client.SubscriptionID,
   149  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   150  		return result, validation.NewError("insights.FavoritesClient", "Delete", err.Error())
   151  	}
   152  
   153  	req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, favoriteID)
   154  	if err != nil {
   155  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", nil, "Failure preparing request")
   156  		return
   157  	}
   158  
   159  	resp, err := client.DeleteSender(req)
   160  	if err != nil {
   161  		result.Response = resp
   162  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure sending request")
   163  		return
   164  	}
   165  
   166  	result, err = client.DeleteResponder(resp)
   167  	if err != nil {
   168  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Delete", resp, "Failure responding to request")
   169  		return
   170  	}
   171  
   172  	return
   173  }
   174  
   175  // DeletePreparer prepares the Delete request.
   176  func (client FavoritesClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) {
   177  	pathParameters := map[string]interface{}{
   178  		"favoriteId":        autorest.Encode("path", favoriteID),
   179  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   180  		"resourceName":      autorest.Encode("path", resourceName),
   181  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   182  	}
   183  
   184  	const APIVersion = "2015-05-01"
   185  	queryParameters := map[string]interface{}{
   186  		"api-version": APIVersion,
   187  	}
   188  
   189  	preparer := autorest.CreatePreparer(
   190  		autorest.AsDelete(),
   191  		autorest.WithBaseURL(client.BaseURI),
   192  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters),
   193  		autorest.WithQueryParameters(queryParameters))
   194  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   195  }
   196  
   197  // DeleteSender sends the Delete request. The method will close the
   198  // http.Response Body if it receives an error.
   199  func (client FavoritesClient) DeleteSender(req *http.Request) (*http.Response, error) {
   200  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   201  }
   202  
   203  // DeleteResponder handles the response to the Delete request. The method always
   204  // closes the http.Response Body.
   205  func (client FavoritesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
   206  	err = autorest.Respond(
   207  		resp,
   208  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   209  		autorest.ByClosing())
   210  	result.Response = resp
   211  	return
   212  }
   213  
   214  // Get get a single favorite by its FavoriteId, defined within an Application Insights component.
   215  // Parameters:
   216  // resourceGroupName - the name of the resource group. The name is case insensitive.
   217  // resourceName - the name of the Application Insights component resource.
   218  // favoriteID - the Id of a specific favorite defined in the Application Insights component
   219  func (client FavoritesClient) Get(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (result ApplicationInsightsComponentFavorite, err error) {
   220  	if tracing.IsEnabled() {
   221  		ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Get")
   222  		defer func() {
   223  			sc := -1
   224  			if result.Response.Response != nil {
   225  				sc = result.Response.Response.StatusCode
   226  			}
   227  			tracing.EndSpan(ctx, sc, err)
   228  		}()
   229  	}
   230  	if err := validation.Validate([]validation.Validation{
   231  		{TargetValue: resourceGroupName,
   232  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   233  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   234  		{TargetValue: client.SubscriptionID,
   235  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   236  		return result, validation.NewError("insights.FavoritesClient", "Get", err.Error())
   237  	}
   238  
   239  	req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, favoriteID)
   240  	if err != nil {
   241  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", nil, "Failure preparing request")
   242  		return
   243  	}
   244  
   245  	resp, err := client.GetSender(req)
   246  	if err != nil {
   247  		result.Response = autorest.Response{Response: resp}
   248  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure sending request")
   249  		return
   250  	}
   251  
   252  	result, err = client.GetResponder(resp)
   253  	if err != nil {
   254  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Get", resp, "Failure responding to request")
   255  		return
   256  	}
   257  
   258  	return
   259  }
   260  
   261  // GetPreparer prepares the Get request.
   262  func (client FavoritesClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string) (*http.Request, error) {
   263  	pathParameters := map[string]interface{}{
   264  		"favoriteId":        autorest.Encode("path", favoriteID),
   265  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   266  		"resourceName":      autorest.Encode("path", resourceName),
   267  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   268  	}
   269  
   270  	const APIVersion = "2015-05-01"
   271  	queryParameters := map[string]interface{}{
   272  		"api-version": APIVersion,
   273  	}
   274  
   275  	preparer := autorest.CreatePreparer(
   276  		autorest.AsGet(),
   277  		autorest.WithBaseURL(client.BaseURI),
   278  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters),
   279  		autorest.WithQueryParameters(queryParameters))
   280  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   281  }
   282  
   283  // GetSender sends the Get request. The method will close the
   284  // http.Response Body if it receives an error.
   285  func (client FavoritesClient) GetSender(req *http.Request) (*http.Response, error) {
   286  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   287  }
   288  
   289  // GetResponder handles the response to the Get request. The method always
   290  // closes the http.Response Body.
   291  func (client FavoritesClient) GetResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) {
   292  	err = autorest.Respond(
   293  		resp,
   294  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   295  		autorest.ByUnmarshallingJSON(&result),
   296  		autorest.ByClosing())
   297  	result.Response = autorest.Response{Response: resp}
   298  	return
   299  }
   300  
   301  // List gets a list of favorites defined within an Application Insights component.
   302  // Parameters:
   303  // resourceGroupName - the name of the resource group. The name is case insensitive.
   304  // resourceName - the name of the Application Insights component resource.
   305  // favoriteType - the type of favorite. Value can be either shared or user.
   306  // sourceType - source type of favorite to return. When left out, the source type defaults to 'other' (not
   307  // present in this enum).
   308  // canFetchContent - flag indicating whether or not to return the full content for each applicable favorite. If
   309  // false, only return summary content for favorites.
   310  // tags - tags that must be present on each favorite returned.
   311  func (client FavoritesClient) List(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []string) (result ListApplicationInsightsComponentFavorite, err error) {
   312  	if tracing.IsEnabled() {
   313  		ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.List")
   314  		defer func() {
   315  			sc := -1
   316  			if result.Response.Response != nil {
   317  				sc = result.Response.Response.StatusCode
   318  			}
   319  			tracing.EndSpan(ctx, sc, err)
   320  		}()
   321  	}
   322  	if err := validation.Validate([]validation.Validation{
   323  		{TargetValue: resourceGroupName,
   324  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   325  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   326  		{TargetValue: client.SubscriptionID,
   327  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   328  		return result, validation.NewError("insights.FavoritesClient", "List", err.Error())
   329  	}
   330  
   331  	req, err := client.ListPreparer(ctx, resourceGroupName, resourceName, favoriteType, sourceType, canFetchContent, tags)
   332  	if err != nil {
   333  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", nil, "Failure preparing request")
   334  		return
   335  	}
   336  
   337  	resp, err := client.ListSender(req)
   338  	if err != nil {
   339  		result.Response = autorest.Response{Response: resp}
   340  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", resp, "Failure sending request")
   341  		return
   342  	}
   343  
   344  	result, err = client.ListResponder(resp)
   345  	if err != nil {
   346  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "List", resp, "Failure responding to request")
   347  		return
   348  	}
   349  
   350  	return
   351  }
   352  
   353  // ListPreparer prepares the List request.
   354  func (client FavoritesClient) ListPreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteType FavoriteType, sourceType FavoriteSourceType, canFetchContent *bool, tags []string) (*http.Request, error) {
   355  	pathParameters := map[string]interface{}{
   356  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   357  		"resourceName":      autorest.Encode("path", resourceName),
   358  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   359  	}
   360  
   361  	const APIVersion = "2015-05-01"
   362  	queryParameters := map[string]interface{}{
   363  		"api-version": APIVersion,
   364  	}
   365  	if len(string(favoriteType)) > 0 {
   366  		queryParameters["favoriteType"] = autorest.Encode("query", favoriteType)
   367  	} else {
   368  		queryParameters["favoriteType"] = autorest.Encode("query", "shared")
   369  	}
   370  	if len(string(sourceType)) > 0 {
   371  		queryParameters["sourceType"] = autorest.Encode("query", sourceType)
   372  	}
   373  	if canFetchContent != nil {
   374  		queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent)
   375  	}
   376  	if tags != nil && len(tags) > 0 {
   377  		queryParameters["tags"] = autorest.Encode("query", tags, ",")
   378  	}
   379  
   380  	preparer := autorest.CreatePreparer(
   381  		autorest.AsGet(),
   382  		autorest.WithBaseURL(client.BaseURI),
   383  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites", pathParameters),
   384  		autorest.WithQueryParameters(queryParameters))
   385  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   386  }
   387  
   388  // ListSender sends the List request. The method will close the
   389  // http.Response Body if it receives an error.
   390  func (client FavoritesClient) ListSender(req *http.Request) (*http.Response, error) {
   391  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   392  }
   393  
   394  // ListResponder handles the response to the List request. The method always
   395  // closes the http.Response Body.
   396  func (client FavoritesClient) ListResponder(resp *http.Response) (result ListApplicationInsightsComponentFavorite, err error) {
   397  	err = autorest.Respond(
   398  		resp,
   399  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   400  		autorest.ByUnmarshallingJSON(&result.Value),
   401  		autorest.ByClosing())
   402  	result.Response = autorest.Response{Response: resp}
   403  	return
   404  }
   405  
   406  // Update updates a favorite that has already been added to an Application Insights component.
   407  // Parameters:
   408  // resourceGroupName - the name of the resource group. The name is case insensitive.
   409  // resourceName - the name of the Application Insights component resource.
   410  // favoriteID - the Id of a specific favorite defined in the Application Insights component
   411  // favoriteProperties - properties that need to be specified to update the existing favorite.
   412  func (client FavoritesClient) Update(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (result ApplicationInsightsComponentFavorite, err error) {
   413  	if tracing.IsEnabled() {
   414  		ctx = tracing.StartSpan(ctx, fqdn+"/FavoritesClient.Update")
   415  		defer func() {
   416  			sc := -1
   417  			if result.Response.Response != nil {
   418  				sc = result.Response.Response.StatusCode
   419  			}
   420  			tracing.EndSpan(ctx, sc, err)
   421  		}()
   422  	}
   423  	if err := validation.Validate([]validation.Validation{
   424  		{TargetValue: resourceGroupName,
   425  			Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil},
   426  				{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}}},
   427  		{TargetValue: client.SubscriptionID,
   428  			Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil {
   429  		return result, validation.NewError("insights.FavoritesClient", "Update", err.Error())
   430  	}
   431  
   432  	req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, favoriteID, favoriteProperties)
   433  	if err != nil {
   434  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", nil, "Failure preparing request")
   435  		return
   436  	}
   437  
   438  	resp, err := client.UpdateSender(req)
   439  	if err != nil {
   440  		result.Response = autorest.Response{Response: resp}
   441  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure sending request")
   442  		return
   443  	}
   444  
   445  	result, err = client.UpdateResponder(resp)
   446  	if err != nil {
   447  		err = autorest.NewErrorWithError(err, "insights.FavoritesClient", "Update", resp, "Failure responding to request")
   448  		return
   449  	}
   450  
   451  	return
   452  }
   453  
   454  // UpdatePreparer prepares the Update request.
   455  func (client FavoritesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, favoriteID string, favoriteProperties ApplicationInsightsComponentFavorite) (*http.Request, error) {
   456  	pathParameters := map[string]interface{}{
   457  		"favoriteId":        autorest.Encode("path", favoriteID),
   458  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   459  		"resourceName":      autorest.Encode("path", resourceName),
   460  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   461  	}
   462  
   463  	const APIVersion = "2015-05-01"
   464  	queryParameters := map[string]interface{}{
   465  		"api-version": APIVersion,
   466  	}
   467  
   468  	favoriteProperties.FavoriteID = nil
   469  	favoriteProperties.TimeModified = nil
   470  	favoriteProperties.UserID = nil
   471  	preparer := autorest.CreatePreparer(
   472  		autorest.AsContentType("application/json; charset=utf-8"),
   473  		autorest.AsPatch(),
   474  		autorest.WithBaseURL(client.BaseURI),
   475  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components/{resourceName}/favorites/{favoriteId}", pathParameters),
   476  		autorest.WithJSON(favoriteProperties),
   477  		autorest.WithQueryParameters(queryParameters))
   478  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   479  }
   480  
   481  // UpdateSender sends the Update request. The method will close the
   482  // http.Response Body if it receives an error.
   483  func (client FavoritesClient) UpdateSender(req *http.Request) (*http.Response, error) {
   484  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   485  }
   486  
   487  // UpdateResponder handles the response to the Update request. The method always
   488  // closes the http.Response Body.
   489  func (client FavoritesClient) UpdateResponder(resp *http.Response) (result ApplicationInsightsComponentFavorite, err error) {
   490  	err = autorest.Respond(
   491  		resp,
   492  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   493  		autorest.ByUnmarshallingJSON(&result),
   494  		autorest.ByClosing())
   495  	result.Response = autorest.Response{Response: resp}
   496  	return
   497  }
   498  

View as plain text