...

Source file src/github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network/expressroutecrossconnections.go

Documentation: github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network

     1  package network
     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  // ExpressRouteCrossConnectionsClient is the network Client
    18  type ExpressRouteCrossConnectionsClient struct {
    19  	BaseClient
    20  }
    21  
    22  // NewExpressRouteCrossConnectionsClient creates an instance of the ExpressRouteCrossConnectionsClient client.
    23  func NewExpressRouteCrossConnectionsClient(subscriptionID string) ExpressRouteCrossConnectionsClient {
    24  	return NewExpressRouteCrossConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID)
    25  }
    26  
    27  // NewExpressRouteCrossConnectionsClientWithBaseURI creates an instance of the ExpressRouteCrossConnectionsClient
    28  // client using a custom endpoint.  Use this when interacting with an Azure cloud that uses a non-standard base URI
    29  // (sovereign clouds, Azure stack).
    30  func NewExpressRouteCrossConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCrossConnectionsClient {
    31  	return ExpressRouteCrossConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)}
    32  }
    33  
    34  // CreateOrUpdate update the specified ExpressRouteCrossConnection.
    35  // Parameters:
    36  // resourceGroupName - the name of the resource group.
    37  // crossConnectionName - the name of the ExpressRouteCrossConnection.
    38  // parameters - parameters supplied to the update express route crossConnection operation.
    39  func (client ExpressRouteCrossConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (result ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) {
    40  	if tracing.IsEnabled() {
    41  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.CreateOrUpdate")
    42  		defer func() {
    43  			sc := -1
    44  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
    45  				sc = result.FutureAPI.Response().StatusCode
    46  			}
    47  			tracing.EndSpan(ctx, sc, err)
    48  		}()
    49  	}
    50  	req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, crossConnectionName, parameters)
    51  	if err != nil {
    52  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request")
    53  		return
    54  	}
    55  
    56  	result, err = client.CreateOrUpdateSender(req)
    57  	if err != nil {
    58  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request")
    59  		return
    60  	}
    61  
    62  	return
    63  }
    64  
    65  // CreateOrUpdatePreparer prepares the CreateOrUpdate request.
    66  func (client ExpressRouteCrossConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (*http.Request, error) {
    67  	pathParameters := map[string]interface{}{
    68  		"crossConnectionName": autorest.Encode("path", crossConnectionName),
    69  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
    70  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
    71  	}
    72  
    73  	const APIVersion = "2021-08-01"
    74  	queryParameters := map[string]interface{}{
    75  		"api-version": APIVersion,
    76  	}
    77  
    78  	parameters.Etag = nil
    79  	preparer := autorest.CreatePreparer(
    80  		autorest.AsContentType("application/json; charset=utf-8"),
    81  		autorest.AsPut(),
    82  		autorest.WithBaseURL(client.BaseURI),
    83  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters),
    84  		autorest.WithJSON(parameters),
    85  		autorest.WithQueryParameters(queryParameters))
    86  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
    87  }
    88  
    89  // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
    90  // http.Response Body if it receives an error.
    91  func (client ExpressRouteCrossConnectionsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) {
    92  	var resp *http.Response
    93  	future.FutureAPI = &azure.Future{}
    94  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
    95  	if err != nil {
    96  		return
    97  	}
    98  	var azf azure.Future
    99  	azf, err = azure.NewFutureFromResponse(resp)
   100  	future.FutureAPI = &azf
   101  	future.Result = future.result
   102  	return
   103  }
   104  
   105  // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
   106  // closes the http.Response Body.
   107  func (client ExpressRouteCrossConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) {
   108  	err = autorest.Respond(
   109  		resp,
   110  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   111  		autorest.ByUnmarshallingJSON(&result),
   112  		autorest.ByClosing())
   113  	result.Response = autorest.Response{Response: resp}
   114  	return
   115  }
   116  
   117  // Get gets details about the specified ExpressRouteCrossConnection.
   118  // Parameters:
   119  // resourceGroupName - the name of the resource group (peering location of the circuit).
   120  // crossConnectionName - the name of the ExpressRouteCrossConnection (service key of the circuit).
   121  func (client ExpressRouteCrossConnectionsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnection, err error) {
   122  	if tracing.IsEnabled() {
   123  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.Get")
   124  		defer func() {
   125  			sc := -1
   126  			if result.Response.Response != nil {
   127  				sc = result.Response.Response.StatusCode
   128  			}
   129  			tracing.EndSpan(ctx, sc, err)
   130  		}()
   131  	}
   132  	req, err := client.GetPreparer(ctx, resourceGroupName, crossConnectionName)
   133  	if err != nil {
   134  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", nil, "Failure preparing request")
   135  		return
   136  	}
   137  
   138  	resp, err := client.GetSender(req)
   139  	if err != nil {
   140  		result.Response = autorest.Response{Response: resp}
   141  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure sending request")
   142  		return
   143  	}
   144  
   145  	result, err = client.GetResponder(resp)
   146  	if err != nil {
   147  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure responding to request")
   148  		return
   149  	}
   150  
   151  	return
   152  }
   153  
   154  // GetPreparer prepares the Get request.
   155  func (client ExpressRouteCrossConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string) (*http.Request, error) {
   156  	pathParameters := map[string]interface{}{
   157  		"crossConnectionName": autorest.Encode("path", crossConnectionName),
   158  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
   159  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
   160  	}
   161  
   162  	const APIVersion = "2021-08-01"
   163  	queryParameters := map[string]interface{}{
   164  		"api-version": APIVersion,
   165  	}
   166  
   167  	preparer := autorest.CreatePreparer(
   168  		autorest.AsGet(),
   169  		autorest.WithBaseURL(client.BaseURI),
   170  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters),
   171  		autorest.WithQueryParameters(queryParameters))
   172  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   173  }
   174  
   175  // GetSender sends the Get request. The method will close the
   176  // http.Response Body if it receives an error.
   177  func (client ExpressRouteCrossConnectionsClient) GetSender(req *http.Request) (*http.Response, error) {
   178  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   179  }
   180  
   181  // GetResponder handles the response to the Get request. The method always
   182  // closes the http.Response Body.
   183  func (client ExpressRouteCrossConnectionsClient) GetResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) {
   184  	err = autorest.Respond(
   185  		resp,
   186  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   187  		autorest.ByUnmarshallingJSON(&result),
   188  		autorest.ByClosing())
   189  	result.Response = autorest.Response{Response: resp}
   190  	return
   191  }
   192  
   193  // List retrieves all the ExpressRouteCrossConnections in a subscription.
   194  func (client ExpressRouteCrossConnectionsClient) List(ctx context.Context) (result ExpressRouteCrossConnectionListResultPage, err error) {
   195  	if tracing.IsEnabled() {
   196  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.List")
   197  		defer func() {
   198  			sc := -1
   199  			if result.ercclr.Response.Response != nil {
   200  				sc = result.ercclr.Response.Response.StatusCode
   201  			}
   202  			tracing.EndSpan(ctx, sc, err)
   203  		}()
   204  	}
   205  	result.fn = client.listNextResults
   206  	req, err := client.ListPreparer(ctx)
   207  	if err != nil {
   208  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", nil, "Failure preparing request")
   209  		return
   210  	}
   211  
   212  	resp, err := client.ListSender(req)
   213  	if err != nil {
   214  		result.ercclr.Response = autorest.Response{Response: resp}
   215  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure sending request")
   216  		return
   217  	}
   218  
   219  	result.ercclr, err = client.ListResponder(resp)
   220  	if err != nil {
   221  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure responding to request")
   222  		return
   223  	}
   224  	if result.ercclr.hasNextLink() && result.ercclr.IsEmpty() {
   225  		err = result.NextWithContext(ctx)
   226  		return
   227  	}
   228  
   229  	return
   230  }
   231  
   232  // ListPreparer prepares the List request.
   233  func (client ExpressRouteCrossConnectionsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
   234  	pathParameters := map[string]interface{}{
   235  		"subscriptionId": autorest.Encode("path", client.SubscriptionID),
   236  	}
   237  
   238  	const APIVersion = "2021-08-01"
   239  	queryParameters := map[string]interface{}{
   240  		"api-version": APIVersion,
   241  	}
   242  
   243  	preparer := autorest.CreatePreparer(
   244  		autorest.AsGet(),
   245  		autorest.WithBaseURL(client.BaseURI),
   246  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections", pathParameters),
   247  		autorest.WithQueryParameters(queryParameters))
   248  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   249  }
   250  
   251  // ListSender sends the List request. The method will close the
   252  // http.Response Body if it receives an error.
   253  func (client ExpressRouteCrossConnectionsClient) ListSender(req *http.Request) (*http.Response, error) {
   254  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   255  }
   256  
   257  // ListResponder handles the response to the List request. The method always
   258  // closes the http.Response Body.
   259  func (client ExpressRouteCrossConnectionsClient) ListResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) {
   260  	err = autorest.Respond(
   261  		resp,
   262  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   263  		autorest.ByUnmarshallingJSON(&result),
   264  		autorest.ByClosing())
   265  	result.Response = autorest.Response{Response: resp}
   266  	return
   267  }
   268  
   269  // listNextResults retrieves the next set of results, if any.
   270  func (client ExpressRouteCrossConnectionsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) {
   271  	req, err := lastResults.expressRouteCrossConnectionListResultPreparer(ctx)
   272  	if err != nil {
   273  		return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", nil, "Failure preparing next results request")
   274  	}
   275  	if req == nil {
   276  		return
   277  	}
   278  	resp, err := client.ListSender(req)
   279  	if err != nil {
   280  		result.Response = autorest.Response{Response: resp}
   281  		return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure sending next results request")
   282  	}
   283  	result, err = client.ListResponder(resp)
   284  	if err != nil {
   285  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure responding to next results request")
   286  	}
   287  	return
   288  }
   289  
   290  // ListComplete enumerates all values, automatically crossing page boundaries as required.
   291  func (client ExpressRouteCrossConnectionsClient) ListComplete(ctx context.Context) (result ExpressRouteCrossConnectionListResultIterator, err error) {
   292  	if tracing.IsEnabled() {
   293  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.List")
   294  		defer func() {
   295  			sc := -1
   296  			if result.Response().Response.Response != nil {
   297  				sc = result.page.Response().Response.Response.StatusCode
   298  			}
   299  			tracing.EndSpan(ctx, sc, err)
   300  		}()
   301  	}
   302  	result.page, err = client.List(ctx)
   303  	return
   304  }
   305  
   306  // ListArpTable gets the currently advertised ARP table associated with the express route cross connection in a
   307  // resource group.
   308  // Parameters:
   309  // resourceGroupName - the name of the resource group.
   310  // crossConnectionName - the name of the ExpressRouteCrossConnection.
   311  // peeringName - the name of the peering.
   312  // devicePath - the path of the device.
   313  func (client ExpressRouteCrossConnectionsClient) ListArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListArpTableFuture, err error) {
   314  	if tracing.IsEnabled() {
   315  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListArpTable")
   316  		defer func() {
   317  			sc := -1
   318  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   319  				sc = result.FutureAPI.Response().StatusCode
   320  			}
   321  			tracing.EndSpan(ctx, sc, err)
   322  		}()
   323  	}
   324  	req, err := client.ListArpTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath)
   325  	if err != nil {
   326  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", nil, "Failure preparing request")
   327  		return
   328  	}
   329  
   330  	result, err = client.ListArpTableSender(req)
   331  	if err != nil {
   332  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", result.Response(), "Failure sending request")
   333  		return
   334  	}
   335  
   336  	return
   337  }
   338  
   339  // ListArpTablePreparer prepares the ListArpTable request.
   340  func (client ExpressRouteCrossConnectionsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) {
   341  	pathParameters := map[string]interface{}{
   342  		"crossConnectionName": autorest.Encode("path", crossConnectionName),
   343  		"devicePath":          autorest.Encode("path", devicePath),
   344  		"peeringName":         autorest.Encode("path", peeringName),
   345  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
   346  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
   347  	}
   348  
   349  	const APIVersion = "2021-08-01"
   350  	queryParameters := map[string]interface{}{
   351  		"api-version": APIVersion,
   352  	}
   353  
   354  	preparer := autorest.CreatePreparer(
   355  		autorest.AsPost(),
   356  		autorest.WithBaseURL(client.BaseURI),
   357  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters),
   358  		autorest.WithQueryParameters(queryParameters))
   359  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   360  }
   361  
   362  // ListArpTableSender sends the ListArpTable request. The method will close the
   363  // http.Response Body if it receives an error.
   364  func (client ExpressRouteCrossConnectionsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListArpTableFuture, err error) {
   365  	var resp *http.Response
   366  	future.FutureAPI = &azure.Future{}
   367  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   368  	if err != nil {
   369  		return
   370  	}
   371  	var azf azure.Future
   372  	azf, err = azure.NewFutureFromResponse(resp)
   373  	future.FutureAPI = &azf
   374  	future.Result = future.result
   375  	return
   376  }
   377  
   378  // ListArpTableResponder handles the response to the ListArpTable request. The method always
   379  // closes the http.Response Body.
   380  func (client ExpressRouteCrossConnectionsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) {
   381  	err = autorest.Respond(
   382  		resp,
   383  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   384  		autorest.ByUnmarshallingJSON(&result),
   385  		autorest.ByClosing())
   386  	result.Response = autorest.Response{Response: resp}
   387  	return
   388  }
   389  
   390  // ListByResourceGroup retrieves all the ExpressRouteCrossConnections in a resource group.
   391  // Parameters:
   392  // resourceGroupName - the name of the resource group.
   393  func (client ExpressRouteCrossConnectionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultPage, err error) {
   394  	if tracing.IsEnabled() {
   395  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListByResourceGroup")
   396  		defer func() {
   397  			sc := -1
   398  			if result.ercclr.Response.Response != nil {
   399  				sc = result.ercclr.Response.Response.StatusCode
   400  			}
   401  			tracing.EndSpan(ctx, sc, err)
   402  		}()
   403  	}
   404  	result.fn = client.listByResourceGroupNextResults
   405  	req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName)
   406  	if err != nil {
   407  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", nil, "Failure preparing request")
   408  		return
   409  	}
   410  
   411  	resp, err := client.ListByResourceGroupSender(req)
   412  	if err != nil {
   413  		result.ercclr.Response = autorest.Response{Response: resp}
   414  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure sending request")
   415  		return
   416  	}
   417  
   418  	result.ercclr, err = client.ListByResourceGroupResponder(resp)
   419  	if err != nil {
   420  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure responding to request")
   421  		return
   422  	}
   423  	if result.ercclr.hasNextLink() && result.ercclr.IsEmpty() {
   424  		err = result.NextWithContext(ctx)
   425  		return
   426  	}
   427  
   428  	return
   429  }
   430  
   431  // ListByResourceGroupPreparer prepares the ListByResourceGroup request.
   432  func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) {
   433  	pathParameters := map[string]interface{}{
   434  		"resourceGroupName": autorest.Encode("path", resourceGroupName),
   435  		"subscriptionId":    autorest.Encode("path", client.SubscriptionID),
   436  	}
   437  
   438  	const APIVersion = "2021-08-01"
   439  	queryParameters := map[string]interface{}{
   440  		"api-version": APIVersion,
   441  	}
   442  
   443  	preparer := autorest.CreatePreparer(
   444  		autorest.AsGet(),
   445  		autorest.WithBaseURL(client.BaseURI),
   446  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections", pathParameters),
   447  		autorest.WithQueryParameters(queryParameters))
   448  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   449  }
   450  
   451  // ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
   452  // http.Response Body if it receives an error.
   453  func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
   454  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   455  }
   456  
   457  // ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
   458  // closes the http.Response Body.
   459  func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) {
   460  	err = autorest.Respond(
   461  		resp,
   462  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   463  		autorest.ByUnmarshallingJSON(&result),
   464  		autorest.ByClosing())
   465  	result.Response = autorest.Response{Response: resp}
   466  	return
   467  }
   468  
   469  // listByResourceGroupNextResults retrieves the next set of results, if any.
   470  func (client ExpressRouteCrossConnectionsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) {
   471  	req, err := lastResults.expressRouteCrossConnectionListResultPreparer(ctx)
   472  	if err != nil {
   473  		return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
   474  	}
   475  	if req == nil {
   476  		return
   477  	}
   478  	resp, err := client.ListByResourceGroupSender(req)
   479  	if err != nil {
   480  		result.Response = autorest.Response{Response: resp}
   481  		return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
   482  	}
   483  	result, err = client.ListByResourceGroupResponder(resp)
   484  	if err != nil {
   485  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
   486  	}
   487  	return
   488  }
   489  
   490  // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
   491  func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultIterator, err error) {
   492  	if tracing.IsEnabled() {
   493  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListByResourceGroup")
   494  		defer func() {
   495  			sc := -1
   496  			if result.Response().Response.Response != nil {
   497  				sc = result.page.Response().Response.Response.StatusCode
   498  			}
   499  			tracing.EndSpan(ctx, sc, err)
   500  		}()
   501  	}
   502  	result.page, err = client.ListByResourceGroup(ctx, resourceGroupName)
   503  	return
   504  }
   505  
   506  // ListRoutesTable gets the currently advertised routes table associated with the express route cross connection in a
   507  // resource group.
   508  // Parameters:
   509  // resourceGroupName - the name of the resource group.
   510  // crossConnectionName - the name of the ExpressRouteCrossConnection.
   511  // peeringName - the name of the peering.
   512  // devicePath - the path of the device.
   513  func (client ExpressRouteCrossConnectionsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableFuture, err error) {
   514  	if tracing.IsEnabled() {
   515  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListRoutesTable")
   516  		defer func() {
   517  			sc := -1
   518  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   519  				sc = result.FutureAPI.Response().StatusCode
   520  			}
   521  			tracing.EndSpan(ctx, sc, err)
   522  		}()
   523  	}
   524  	req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath)
   525  	if err != nil {
   526  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", nil, "Failure preparing request")
   527  		return
   528  	}
   529  
   530  	result, err = client.ListRoutesTableSender(req)
   531  	if err != nil {
   532  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", result.Response(), "Failure sending request")
   533  		return
   534  	}
   535  
   536  	return
   537  }
   538  
   539  // ListRoutesTablePreparer prepares the ListRoutesTable request.
   540  func (client ExpressRouteCrossConnectionsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) {
   541  	pathParameters := map[string]interface{}{
   542  		"crossConnectionName": autorest.Encode("path", crossConnectionName),
   543  		"devicePath":          autorest.Encode("path", devicePath),
   544  		"peeringName":         autorest.Encode("path", peeringName),
   545  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
   546  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
   547  	}
   548  
   549  	const APIVersion = "2021-08-01"
   550  	queryParameters := map[string]interface{}{
   551  		"api-version": APIVersion,
   552  	}
   553  
   554  	preparer := autorest.CreatePreparer(
   555  		autorest.AsPost(),
   556  		autorest.WithBaseURL(client.BaseURI),
   557  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters),
   558  		autorest.WithQueryParameters(queryParameters))
   559  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   560  }
   561  
   562  // ListRoutesTableSender sends the ListRoutesTable request. The method will close the
   563  // http.Response Body if it receives an error.
   564  func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableFuture, err error) {
   565  	var resp *http.Response
   566  	future.FutureAPI = &azure.Future{}
   567  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   568  	if err != nil {
   569  		return
   570  	}
   571  	var azf azure.Future
   572  	azf, err = azure.NewFutureFromResponse(resp)
   573  	future.FutureAPI = &azf
   574  	future.Result = future.result
   575  	return
   576  }
   577  
   578  // ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always
   579  // closes the http.Response Body.
   580  func (client ExpressRouteCrossConnectionsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) {
   581  	err = autorest.Respond(
   582  		resp,
   583  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   584  		autorest.ByUnmarshallingJSON(&result),
   585  		autorest.ByClosing())
   586  	result.Response = autorest.Response{Response: resp}
   587  	return
   588  }
   589  
   590  // ListRoutesTableSummary gets the route table summary associated with the express route cross connection in a resource
   591  // group.
   592  // Parameters:
   593  // resourceGroupName - the name of the resource group.
   594  // crossConnectionName - the name of the ExpressRouteCrossConnection.
   595  // peeringName - the name of the peering.
   596  // devicePath - the path of the device.
   597  func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) {
   598  	if tracing.IsEnabled() {
   599  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListRoutesTableSummary")
   600  		defer func() {
   601  			sc := -1
   602  			if result.FutureAPI != nil && result.FutureAPI.Response() != nil {
   603  				sc = result.FutureAPI.Response().StatusCode
   604  			}
   605  			tracing.EndSpan(ctx, sc, err)
   606  		}()
   607  	}
   608  	req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath)
   609  	if err != nil {
   610  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", nil, "Failure preparing request")
   611  		return
   612  	}
   613  
   614  	result, err = client.ListRoutesTableSummarySender(req)
   615  	if err != nil {
   616  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", result.Response(), "Failure sending request")
   617  		return
   618  	}
   619  
   620  	return
   621  }
   622  
   623  // ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request.
   624  func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) {
   625  	pathParameters := map[string]interface{}{
   626  		"crossConnectionName": autorest.Encode("path", crossConnectionName),
   627  		"devicePath":          autorest.Encode("path", devicePath),
   628  		"peeringName":         autorest.Encode("path", peeringName),
   629  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
   630  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
   631  	}
   632  
   633  	const APIVersion = "2021-08-01"
   634  	queryParameters := map[string]interface{}{
   635  		"api-version": APIVersion,
   636  	}
   637  
   638  	preparer := autorest.CreatePreparer(
   639  		autorest.AsPost(),
   640  		autorest.WithBaseURL(client.BaseURI),
   641  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters),
   642  		autorest.WithQueryParameters(queryParameters))
   643  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   644  }
   645  
   646  // ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the
   647  // http.Response Body if it receives an error.
   648  func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) {
   649  	var resp *http.Response
   650  	future.FutureAPI = &azure.Future{}
   651  	resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))
   652  	if err != nil {
   653  		return
   654  	}
   655  	var azf azure.Future
   656  	azf, err = azure.NewFutureFromResponse(resp)
   657  	future.FutureAPI = &azf
   658  	future.Result = future.result
   659  	return
   660  }
   661  
   662  // ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always
   663  // closes the http.Response Body.
   664  func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) {
   665  	err = autorest.Respond(
   666  		resp,
   667  		azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
   668  		autorest.ByUnmarshallingJSON(&result),
   669  		autorest.ByClosing())
   670  	result.Response = autorest.Response{Response: resp}
   671  	return
   672  }
   673  
   674  // UpdateTags updates an express route cross connection tags.
   675  // Parameters:
   676  // resourceGroupName - the name of the resource group.
   677  // crossConnectionName - the name of the cross connection.
   678  // crossConnectionParameters - parameters supplied to update express route cross connection tags.
   679  func (client ExpressRouteCrossConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (result ExpressRouteCrossConnection, err error) {
   680  	if tracing.IsEnabled() {
   681  		ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.UpdateTags")
   682  		defer func() {
   683  			sc := -1
   684  			if result.Response.Response != nil {
   685  				sc = result.Response.Response.StatusCode
   686  			}
   687  			tracing.EndSpan(ctx, sc, err)
   688  		}()
   689  	}
   690  	req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, crossConnectionName, crossConnectionParameters)
   691  	if err != nil {
   692  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", nil, "Failure preparing request")
   693  		return
   694  	}
   695  
   696  	resp, err := client.UpdateTagsSender(req)
   697  	if err != nil {
   698  		result.Response = autorest.Response{Response: resp}
   699  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", resp, "Failure sending request")
   700  		return
   701  	}
   702  
   703  	result, err = client.UpdateTagsResponder(resp)
   704  	if err != nil {
   705  		err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", resp, "Failure responding to request")
   706  		return
   707  	}
   708  
   709  	return
   710  }
   711  
   712  // UpdateTagsPreparer prepares the UpdateTags request.
   713  func (client ExpressRouteCrossConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (*http.Request, error) {
   714  	pathParameters := map[string]interface{}{
   715  		"crossConnectionName": autorest.Encode("path", crossConnectionName),
   716  		"resourceGroupName":   autorest.Encode("path", resourceGroupName),
   717  		"subscriptionId":      autorest.Encode("path", client.SubscriptionID),
   718  	}
   719  
   720  	const APIVersion = "2021-08-01"
   721  	queryParameters := map[string]interface{}{
   722  		"api-version": APIVersion,
   723  	}
   724  
   725  	preparer := autorest.CreatePreparer(
   726  		autorest.AsContentType("application/json; charset=utf-8"),
   727  		autorest.AsPatch(),
   728  		autorest.WithBaseURL(client.BaseURI),
   729  		autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters),
   730  		autorest.WithJSON(crossConnectionParameters),
   731  		autorest.WithQueryParameters(queryParameters))
   732  	return preparer.Prepare((&http.Request{}).WithContext(ctx))
   733  }
   734  
   735  // UpdateTagsSender sends the UpdateTags request. The method will close the
   736  // http.Response Body if it receives an error.
   737  func (client ExpressRouteCrossConnectionsClient) UpdateTagsSender(req *http.Request) (*http.Response, error) {
   738  	return client.Send(req, azure.DoRetryWithRegistration(client.Client))
   739  }
   740  
   741  // UpdateTagsResponder handles the response to the UpdateTags request. The method always
   742  // closes the http.Response Body.
   743  func (client ExpressRouteCrossConnectionsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) {
   744  	err = autorest.Respond(
   745  		resp,
   746  		azure.WithErrorUnlessStatusCode(http.StatusOK),
   747  		autorest.ByUnmarshallingJSON(&result),
   748  		autorest.ByClosing())
   749  	result.Response = autorest.Response{Response: resp}
   750  	return
   751  }
   752  

View as plain text