diff --git a/profiles/preview/network/mgmt/network/models.go b/profiles/preview/network/mgmt/network/models.go index 0df002b98168..5e310277cb8d 100644 --- a/profiles/preview/network/mgmt/network/models.go +++ b/profiles/preview/network/mgmt/network/models.go @@ -883,7 +883,6 @@ type ConnectionMonitorsCreateOrUpdateFuture = original.ConnectionMonitorsCreateO type ConnectionMonitorsDeleteFuture = original.ConnectionMonitorsDeleteFuture type ConnectionMonitorSource = original.ConnectionMonitorSource type ConnectionMonitorsQueryFuture = original.ConnectionMonitorsQueryFuture -type ConnectionMonitorsQueryResultItem = original.ConnectionMonitorsQueryResultItem type ConnectionMonitorsStartFuture = original.ConnectionMonitorsStartFuture type ConnectionMonitorsStopFuture = original.ConnectionMonitorsStopFuture type ConnectionResetSharedKey = original.ConnectionResetSharedKey @@ -1119,10 +1118,6 @@ type PublicIPAddressListResultIterator = original.PublicIPAddressListResultItera type PublicIPAddressListResultPage = original.PublicIPAddressListResultPage type PublicIPAddressPropertiesFormat = original.PublicIPAddressPropertiesFormat type PublicIPAddressSku = original.PublicIPAddressSku -type QueryConnectionMonitorsParameters = original.QueryConnectionMonitorsParameters -type QueryConnectionMonitorsResponse = original.QueryConnectionMonitorsResponse -type QueryConnectionMonitorsResponseIterator = original.QueryConnectionMonitorsResponseIterator -type QueryConnectionMonitorsResponsePage = original.QueryConnectionMonitorsResponsePage type QueryTroubleshootingParameters = original.QueryTroubleshootingParameters type Resource = original.Resource type ResourceNavigationLink = original.ResourceNavigationLink @@ -1315,8 +1310,6 @@ type WatchersGetTroubleshootingFuture = original.WatchersGetTroubleshootingFutur type WatchersGetTroubleshootingResultFuture = original.WatchersGetTroubleshootingResultFuture type WatchersGetVMSecurityRulesFuture = original.WatchersGetVMSecurityRulesFuture type WatchersListAvailableProvidersFuture = original.WatchersListAvailableProvidersFuture -type WatchersQueryConnectionMonitorsAllFuture = original.WatchersQueryConnectionMonitorsAllFuture -type WatchersQueryConnectionMonitorsFuture = original.WatchersQueryConnectionMonitorsFuture type WatchersSetFlowLogConfigurationFuture = original.WatchersSetFlowLogConfigurationFuture type WatchersVerifyIPFlowFuture = original.WatchersVerifyIPFlowFuture type OperationsClient = original.OperationsClient diff --git a/services/network/mgmt/2018-06-01/network/models.go b/services/network/mgmt/2018-06-01/network/models.go index 849d898317d9..d9ef6e372b5b 100644 --- a/services/network/mgmt/2018-06-01/network/models.go +++ b/services/network/mgmt/2018-06-01/network/models.go @@ -5802,13 +5802,6 @@ func (future *ConnectionMonitorsQueryFuture) Result(client ConnectionMonitorsCli return } -// ConnectionMonitorsQueryResultItem results of query particular connection monitor. -type ConnectionMonitorsQueryResultItem struct { - // ResourceID - Connection monitor resource ID. - ResourceID *string `json:"resourceId,omitempty"` - Report *ConnectionMonitorQueryResult `json:"report,omitempty"` -} - // ConnectionMonitorsStartFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type ConnectionMonitorsStartFuture struct { @@ -13336,115 +13329,6 @@ type PublicIPAddressSku struct { Name PublicIPAddressSkuName `json:"name,omitempty"` } -// QueryConnectionMonitorsParameters parameters to query connection monitors. -type QueryConnectionMonitorsParameters struct { - // ConnectionMonitorIds - List of connection monitors ID. - ConnectionMonitorIds *[]string `json:"connectionMonitorIds,omitempty"` -} - -// QueryConnectionMonitorsResponse results of query connection monitors. -type QueryConnectionMonitorsResponse struct { - autorest.Response `json:"-"` - // Value - The list query connection monitor results. - Value *[]ConnectionMonitorsQueryResultItem `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// QueryConnectionMonitorsResponseIterator provides access to a complete listing of -// ConnectionMonitorsQueryResultItem values. -type QueryConnectionMonitorsResponseIterator struct { - i int - page QueryConnectionMonitorsResponsePage -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *QueryConnectionMonitorsResponseIterator) Next() error { - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err := iter.page.Next() - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter QueryConnectionMonitorsResponseIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter QueryConnectionMonitorsResponseIterator) Response() QueryConnectionMonitorsResponse { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter QueryConnectionMonitorsResponseIterator) Value() ConnectionMonitorsQueryResultItem { - if !iter.page.NotDone() { - return ConnectionMonitorsQueryResultItem{} - } - return iter.page.Values()[iter.i] -} - -// IsEmpty returns true if the ListResult contains no values. -func (qcmr QueryConnectionMonitorsResponse) IsEmpty() bool { - return qcmr.Value == nil || len(*qcmr.Value) == 0 -} - -// queryConnectionMonitorsResponsePreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (qcmr QueryConnectionMonitorsResponse) queryConnectionMonitorsResponsePreparer() (*http.Request, error) { - if qcmr.NextLink == nil || len(to.String(qcmr.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare(&http.Request{}, - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(qcmr.NextLink))) -} - -// QueryConnectionMonitorsResponsePage contains a page of ConnectionMonitorsQueryResultItem values. -type QueryConnectionMonitorsResponsePage struct { - fn func(QueryConnectionMonitorsResponse) (QueryConnectionMonitorsResponse, error) - qcmr QueryConnectionMonitorsResponse -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *QueryConnectionMonitorsResponsePage) Next() error { - next, err := page.fn(page.qcmr) - if err != nil { - return err - } - page.qcmr = next - return nil -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page QueryConnectionMonitorsResponsePage) NotDone() bool { - return !page.qcmr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page QueryConnectionMonitorsResponsePage) Response() QueryConnectionMonitorsResponse { - return page.qcmr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page QueryConnectionMonitorsResponsePage) Values() []ConnectionMonitorsQueryResultItem { - if page.qcmr.IsEmpty() { - return nil - } - return *page.qcmr.Value -} - // QueryTroubleshootingParameters parameters that define the resource to query the troubleshooting result. type QueryTroubleshootingParameters struct { // TargetResourceID - The target resource ID to query the troubleshooting result. @@ -19873,64 +19757,6 @@ func (future *WatchersListAvailableProvidersFuture) Result(client WatchersClient return } -// WatchersQueryConnectionMonitorsAllFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type WatchersQueryConnectionMonitorsAllFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *WatchersQueryConnectionMonitorsAllFuture) Result(client WatchersClient) (qcmrp QueryConnectionMonitorsResponsePage, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersQueryConnectionMonitorsAllFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("network.WatchersQueryConnectionMonitorsAllFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if qcmrp.qcmr.Response.Response, err = future.GetResult(sender); err == nil && qcmrp.qcmr.Response.Response.StatusCode != http.StatusNoContent { - qcmrp, err = client.QueryConnectionMonitorsResponder(qcmrp.qcmr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersQueryConnectionMonitorsAllFuture", "Result", qcmrp.qcmr.Response.Response, "Failure responding to request") - } - } - return -} - -// WatchersQueryConnectionMonitorsFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type WatchersQueryConnectionMonitorsFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *WatchersQueryConnectionMonitorsFuture) Result(client WatchersClient) (qcmrp QueryConnectionMonitorsResponsePage, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersQueryConnectionMonitorsFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("network.WatchersQueryConnectionMonitorsFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if qcmrp.qcmr.Response.Response, err = future.GetResult(sender); err == nil && qcmrp.qcmr.Response.Response.StatusCode != http.StatusNoContent { - qcmrp, err = client.QueryConnectionMonitorsResponder(qcmrp.qcmr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersQueryConnectionMonitorsFuture", "Result", qcmrp.qcmr.Response.Response, "Failure responding to request") - } - } - return -} - // WatchersSetFlowLogConfigurationFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type WatchersSetFlowLogConfigurationFuture struct { diff --git a/services/network/mgmt/2018-06-01/network/watchers.go b/services/network/mgmt/2018-06-01/network/watchers.go index 2c0d93584600..5a1813cc3797 100644 --- a/services/network/mgmt/2018-06-01/network/watchers.go +++ b/services/network/mgmt/2018-06-01/network/watchers.go @@ -1172,112 +1172,6 @@ func (client WatchersClient) ListAvailableProvidersResponder(resp *http.Response return } -// QueryConnectionMonitors query connection monitors. -// Parameters: -// resourceGroupName - the name of the resource group. -// networkWatcherName - the name of the network watcher. -// parameters - parameters to get network configuration diagnostic. -func (client WatchersClient) QueryConnectionMonitors(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryConnectionMonitorsParameters) (result WatchersQueryConnectionMonitorsFuture, err error) { - req, err := client.QueryConnectionMonitorsPreparer(ctx, resourceGroupName, networkWatcherName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "QueryConnectionMonitors", nil, "Failure preparing request") - return - } - - result, err = client.QueryConnectionMonitorsSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "network.WatchersClient", "QueryConnectionMonitors", result.Response(), "Failure sending request") - return - } - - return -} - -// QueryConnectionMonitorsPreparer prepares the QueryConnectionMonitors request. -func (client WatchersClient) QueryConnectionMonitorsPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryConnectionMonitorsParameters) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "networkWatcherName": autorest.Encode("path", networkWatcherName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2018-06-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryConnectionMonitors", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// QueryConnectionMonitorsSender sends the QueryConnectionMonitors request. The method will close the -// http.Response Body if it receives an error. -func (client WatchersClient) QueryConnectionMonitorsSender(req *http.Request) (future WatchersQueryConnectionMonitorsFuture, err error) { - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, - azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted)) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// QueryConnectionMonitorsResponder handles the response to the QueryConnectionMonitors request. The method always -// closes the http.Response Body. -func (client WatchersClient) QueryConnectionMonitorsResponder(resp *http.Response) (result QueryConnectionMonitorsResponsePage, err error) { - result.qcmr, err = client.queryConnectionMonitorsResponder(resp) - result.fn = client.queryConnectionMonitorsNextResults - return -} - -func (client WatchersClient) queryConnectionMonitorsResponder(resp *http.Response) (result QueryConnectionMonitorsResponse, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// queryConnectionMonitorsNextResults retrieves the next set of results, if any. -func (client WatchersClient) queryConnectionMonitorsNextResults(lastResults QueryConnectionMonitorsResponse) (result QueryConnectionMonitorsResponse, err error) { - req, err := lastResults.queryConnectionMonitorsResponsePreparer() - if err != nil { - return result, autorest.NewErrorWithError(err, "network.WatchersClient", "queryConnectionMonitorsNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return result, autorest.NewErrorWithError(err, "network.WatchersClient", "queryConnectionMonitorsNextResults", resp, "Failure sending next results request") - } - return client.queryConnectionMonitorsResponder(resp) -} - -// QueryConnectionMonitorsComplete enumerates all values, automatically crossing page boundaries as required. -func (client WatchersClient) QueryConnectionMonitorsComplete(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters QueryConnectionMonitorsParameters) (result WatchersQueryConnectionMonitorsAllFuture, err error) { - var future WatchersQueryConnectionMonitorsFuture - future, err = client.QueryConnectionMonitors(ctx, resourceGroupName, networkWatcherName, parameters) - result.Future = future.Future - return -} - // SetFlowLogConfiguration configures flow log and traffic analytics (optional) on a specified resource. // Parameters: // resourceGroupName - the name of the network watcher resource group.