From 3fb7d1c7a399c10d538214ffc094031ccd161e29 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Wed, 15 Aug 2018 14:31:04 -0700 Subject: [PATCH 1/2] [AutoPR network/resource-manager] Added NetworkConfigurationDiagnostic rest API + example (#2415) * Generated from 6909b52c5e23056444d410930b8702e7540811e2 Removed 'read-only' from queries in NetworkConfigurationDiagnostic API * Generated from f12e6b41326c05506097b75dce076c297074a3d2 Fixed example name * Generated from 9e5daf5f1cd3c59140eec06d6fb55e6456323c54 Fixed reference to ErrorDetails * Generated from 0858a238c818aa119584a9d61deddc2a26494de9 Fixed response for QueryConnectionMonitors API + fixed example * Generated from 377e5cc3f8f10f71d7816d78462fbb68685453bd Fixed types for latencies in networkwatcher.json --- .../preview/network/mgmt/network/models.go | 17 + .../network/mgmt/2018-06-01/network/models.go | 294 ++++++++++++++++++ .../mgmt/2018-06-01/network/watchers.go | 187 +++++++++++ 3 files changed, 498 insertions(+) diff --git a/profiles/preview/network/mgmt/network/models.go b/profiles/preview/network/mgmt/network/models.go index be778f14bf57..0df002b98168 100644 --- a/profiles/preview/network/mgmt/network/models.go +++ b/profiles/preview/network/mgmt/network/models.go @@ -869,6 +869,9 @@ type BgpServiceCommunityListResultIterator = original.BgpServiceCommunityListRes type BgpServiceCommunityListResultPage = original.BgpServiceCommunityListResultPage type BgpServiceCommunityPropertiesFormat = original.BgpServiceCommunityPropertiesFormat type BgpSettings = original.BgpSettings +type ConfigurationDiagnosticParameters = original.ConfigurationDiagnosticParameters +type ConfigurationDiagnosticResponse = original.ConfigurationDiagnosticResponse +type ConfigurationDiagnosticResult = original.ConfigurationDiagnosticResult type ConnectionMonitor = original.ConnectionMonitor type ConnectionMonitorDestination = original.ConnectionMonitorDestination type ConnectionMonitorListResult = original.ConnectionMonitorListResult @@ -880,6 +883,7 @@ 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 @@ -914,6 +918,8 @@ type EndpointServicesListResultIterator = original.EndpointServicesListResultIte type EndpointServicesListResultPage = original.EndpointServicesListResultPage type Error = original.Error type ErrorDetails = original.ErrorDetails +type ErrorResponse = original.ErrorResponse +type EvaluatedNetworkSecurityGroup = original.EvaluatedNetworkSecurityGroup type ExpressRouteCircuit = original.ExpressRouteCircuit type ExpressRouteCircuitArpTable = original.ExpressRouteCircuitArpTable type ExpressRouteCircuitAuthorization = original.ExpressRouteCircuitAuthorization @@ -1072,6 +1078,7 @@ type LocalNetworkGatewaysCreateOrUpdateFuture = original.LocalNetworkGatewaysCre type LocalNetworkGatewaysDeleteFuture = original.LocalNetworkGatewaysDeleteFuture type LocalNetworkGatewaysUpdateTagsFuture = original.LocalNetworkGatewaysUpdateTagsFuture type LogSpecification = original.LogSpecification +type MatchedRule = original.MatchedRule type MetricSpecification = original.MetricSpecification type NextHopParameters = original.NextHopParameters type NextHopResult = original.NextHopResult @@ -1112,6 +1119,10 @@ 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 @@ -1154,6 +1165,7 @@ type SecurityGroupListResultIterator = original.SecurityGroupListResultIterator type SecurityGroupListResultPage = original.SecurityGroupListResultPage type SecurityGroupNetworkInterface = original.SecurityGroupNetworkInterface type SecurityGroupPropertiesFormat = original.SecurityGroupPropertiesFormat +type SecurityGroupResult = original.SecurityGroupResult type SecurityGroupsCreateOrUpdateFuture = original.SecurityGroupsCreateOrUpdateFuture type SecurityGroupsDeleteFuture = original.SecurityGroupsDeleteFuture type SecurityGroupsUpdateTagsFuture = original.SecurityGroupsUpdateTagsFuture @@ -1167,6 +1179,7 @@ type SecurityRuleListResultPage = original.SecurityRuleListResultPage type SecurityRulePropertiesFormat = original.SecurityRulePropertiesFormat type SecurityRulesCreateOrUpdateFuture = original.SecurityRulesCreateOrUpdateFuture type SecurityRulesDeleteFuture = original.SecurityRulesDeleteFuture +type SecurityRulesEvaluationResult = original.SecurityRulesEvaluationResult type ServiceEndpointPropertiesFormat = original.ServiceEndpointPropertiesFormat type String = original.String type Subnet = original.Subnet @@ -1185,6 +1198,7 @@ type TopologyParameters = original.TopologyParameters type TopologyResource = original.TopologyResource type TrafficAnalyticsConfigurationProperties = original.TrafficAnalyticsConfigurationProperties type TrafficAnalyticsProperties = original.TrafficAnalyticsProperties +type TrafficQuery = original.TrafficQuery type TroubleshootingDetails = original.TroubleshootingDetails type TroubleshootingParameters = original.TroubleshootingParameters type TroubleshootingProperties = original.TroubleshootingProperties @@ -1295,11 +1309,14 @@ type WatchersCheckConnectivityFuture = original.WatchersCheckConnectivityFuture type WatchersDeleteFuture = original.WatchersDeleteFuture type WatchersGetAzureReachabilityReportFuture = original.WatchersGetAzureReachabilityReportFuture type WatchersGetFlowLogStatusFuture = original.WatchersGetFlowLogStatusFuture +type WatchersGetNetworkConfigurationDiagnosticFuture = original.WatchersGetNetworkConfigurationDiagnosticFuture type WatchersGetNextHopFuture = original.WatchersGetNextHopFuture type WatchersGetTroubleshootingFuture = original.WatchersGetTroubleshootingFuture 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 f2488eb15c4e..849d898317d9 100644 --- a/services/network/mgmt/2018-06-01/network/models.go +++ b/services/network/mgmt/2018-06-01/network/models.go @@ -5452,6 +5452,27 @@ type BgpSettings struct { PeerWeight *int32 `json:"peerWeight,omitempty"` } +// ConfigurationDiagnosticParameters parameters to get network configuration diagnostic. +type ConfigurationDiagnosticParameters struct { + // TargetResourceID - The ID of the target resource to perform network configuration diagnostic. Valid options are VM, NetworkInterface, VMSS/NetworkInterface and Application Gateway. + TargetResourceID *string `json:"targetResourceId,omitempty"` + // Queries - List of traffic queries. + Queries *[]TrafficQuery `json:"queries,omitempty"` +} + +// ConfigurationDiagnosticResponse results of network configuration diagnostic on the target resource. +type ConfigurationDiagnosticResponse struct { + autorest.Response `json:"-"` + // Results - List of network configuration diagnostic results. + Results *[]ConfigurationDiagnosticResult `json:"results,omitempty"` +} + +// ConfigurationDiagnosticResult network configuration diagnostic result corresponded to provided traffic query. +type ConfigurationDiagnosticResult struct { + TrafficQuery *TrafficQuery `json:"trafficQuery,omitempty"` + NetworkSecurityGroupResult *SecurityGroupResult `json:"networkSecurityGroupResult,omitempty"` +} + // ConnectionMonitor parameters that define the operation to create a connection monitor. type ConnectionMonitor struct { // Location - Connection monitor location. @@ -5781,6 +5802,13 @@ 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 { @@ -5853,6 +5881,16 @@ type ConnectionStateSnapshot struct { EndTime *date.Time `json:"endTime,omitempty"` // EvaluationState - Connectivity analysis evaluation state. Possible values include: 'NotStarted', 'InProgress', 'Completed' EvaluationState EvaluationState `json:"evaluationState,omitempty"` + // AvgLatencyInMs - Average latency in ms. + AvgLatencyInMs *int32 `json:"avgLatencyInMs,omitempty"` + // MinLatencyInMs - Minimum latency in ms. + MinLatencyInMs *int32 `json:"minLatencyInMs,omitempty"` + // MaxLatencyInMs - Maximum latency in ms. + MaxLatencyInMs *int32 `json:"maxLatencyInMs,omitempty"` + // ProbesSent - The number of sent probes. + ProbesSent *int32 `json:"probesSent,omitempty"` + // ProbesFailed - The number of failed probes. + ProbesFailed *int32 `json:"probesFailed,omitempty"` // Hops - List of hops between the source and the destination. Hops *[]ConnectivityHop `json:"hops,omitempty"` } @@ -6487,6 +6525,20 @@ type ErrorDetails struct { Message *string `json:"message,omitempty"` } +// ErrorResponse the error object. +type ErrorResponse struct { + Error *ErrorDetails `json:"error,omitempty"` +} + +// EvaluatedNetworkSecurityGroup results of network security group evaluation. +type EvaluatedNetworkSecurityGroup struct { + // NetworkSecurityGroupID - Network security group ID. + NetworkSecurityGroupID *string `json:"networkSecurityGroupId,omitempty"` + MatchedRule *MatchedRule `json:"matchedRule,omitempty"` + // RulesEvaluationResult - List of network security rules evaluation results. + RulesEvaluationResult *[]SecurityRulesEvaluationResult `json:"rulesEvaluationResult,omitempty"` +} + // ExpressRouteCircuit expressRouteCircuit resource type ExpressRouteCircuit struct { autorest.Response `json:"-"` @@ -11947,6 +11999,14 @@ type LogSpecification struct { BlobDuration *string `json:"blobDuration,omitempty"` } +// MatchedRule matched rule. +type MatchedRule struct { + // RuleName - Name of the matched network security rule. + RuleName *string `json:"ruleName,omitempty"` + // Action - The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. + Action *string `json:"action,omitempty"` +} + // MetricSpecification description of metrics specification. type MetricSpecification struct { // Name - The name of the metric. @@ -13276,6 +13336,115 @@ 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. @@ -14833,6 +15002,14 @@ type SecurityGroupPropertiesFormat struct { ProvisioningState *string `json:"provisioningState,omitempty"` } +// SecurityGroupResult network configuration diagnostic result corresponded provided traffic query. +type SecurityGroupResult struct { + // SecurityRuleAccessResult - The network traffic is allowed or denied. Possible values are 'Allow' and 'Deny'. Possible values include: 'SecurityRuleAccessAllow', 'SecurityRuleAccessDeny' + SecurityRuleAccessResult SecurityRuleAccess `json:"securityRuleAccessResult,omitempty"` + // EvaluatedNetworkSecurityGroups - List of results network security groups diagnostic. + EvaluatedNetworkSecurityGroups *[]EvaluatedNetworkSecurityGroup `json:"evaluatedNetworkSecurityGroups,omitempty"` +} + // SecurityGroupsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running // operation. type SecurityGroupsCreateOrUpdateFuture struct { @@ -15208,6 +15385,22 @@ func (future *SecurityRulesDeleteFuture) Result(client SecurityRulesClient) (ar return } +// SecurityRulesEvaluationResult network security rules evaluation result. +type SecurityRulesEvaluationResult struct { + // Name - Name of the network security rule. + Name *string `json:"name,omitempty"` + // ProtocolMatched - Value indicating whether protocol is matched. + ProtocolMatched *bool `json:"protocolMatched,omitempty"` + // SourceMatched - Value indicating whether source is matched. + SourceMatched *bool `json:"sourceMatched,omitempty"` + // SourcePortMatched - Value indicating whether source port is matched. + SourcePortMatched *bool `json:"sourcePortMatched,omitempty"` + // DestinationMatched - Value indicating whether destination is matched. + DestinationMatched *bool `json:"destinationMatched,omitempty"` + // DestinationPortMatched - Value indicating whether destination port is matched. + DestinationPortMatched *bool `json:"destinationPortMatched,omitempty"` +} + // ServiceEndpointPropertiesFormat the service endpoint properties. type ServiceEndpointPropertiesFormat struct { // Service - The type of the endpoint service. @@ -15567,6 +15760,20 @@ type TrafficAnalyticsProperties struct { NetworkWatcherFlowAnalyticsConfiguration *TrafficAnalyticsConfigurationProperties `json:"networkWatcherFlowAnalyticsConfiguration,omitempty"` } +// TrafficQuery parameters to compare with network configuration. +type TrafficQuery struct { + // Direction - The direction of the traffic. Accepted values are 'Inbound' and 'Outbound'. Possible values include: 'Inbound', 'Outbound' + Direction Direction `json:"direction,omitempty"` + // Protocol - Protocol to be verified on. Accepted values are '*', TCP, UDP. + Protocol *string `json:"protocol,omitempty"` + // Source - Traffic source. Accepted values are '*', IP Address/CIDR, Service Tag. + Source *string `json:"source,omitempty"` + // Destination - Traffic destination. Accepted values are: '*', IP Address/CIDR, Service Tag. + Destination *string `json:"destination,omitempty"` + // DestinationPort - Traffice destination port. Accepted values are '*', port (for example, 3389) and port range (for example, 80-100). + DestinationPort *string `json:"destinationPort,omitempty"` +} + // TroubleshootingDetails information gained from troubleshooting of specified resource. type TroubleshootingDetails struct { // ID - The id of the get troubleshoot operation. @@ -19493,6 +19700,35 @@ func (future *WatchersGetFlowLogStatusFuture) Result(client WatchersClient) (fli return } +// WatchersGetNetworkConfigurationDiagnosticFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type WatchersGetNetworkConfigurationDiagnosticFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *WatchersGetNetworkConfigurationDiagnosticFuture) Result(client WatchersClient) (cdr ConfigurationDiagnosticResponse, err error) { + var done bool + done, err = future.Done(client) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNetworkConfigurationDiagnosticFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("network.WatchersGetNetworkConfigurationDiagnosticFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if cdr.Response.Response, err = future.GetResult(sender); err == nil && cdr.Response.Response.StatusCode != http.StatusNoContent { + cdr, err = client.GetNetworkConfigurationDiagnosticResponder(cdr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersGetNetworkConfigurationDiagnosticFuture", "Result", cdr.Response.Response, "Failure responding to request") + } + } + return +} + // WatchersGetNextHopFuture an abstraction for monitoring and retrieving the results of a long-running operation. type WatchersGetNextHopFuture struct { azure.Future @@ -19637,6 +19873,64 @@ 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 b7cd682491c9..2c0d93584600 100644 --- a/services/network/mgmt/2018-06-01/network/watchers.go +++ b/services/network/mgmt/2018-06-01/network/watchers.go @@ -494,6 +494,87 @@ func (client WatchersClient) GetFlowLogStatusResponder(resp *http.Response) (res return } +// GetNetworkConfigurationDiagnostic get network configuration diagnostic. +// 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) GetNetworkConfigurationDiagnostic(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters) (result WatchersGetNetworkConfigurationDiagnosticFuture, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.Queries", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("network.WatchersClient", "GetNetworkConfigurationDiagnostic", err.Error()) + } + + req, err := client.GetNetworkConfigurationDiagnosticPreparer(ctx, resourceGroupName, networkWatcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNetworkConfigurationDiagnostic", nil, "Failure preparing request") + return + } + + result, err = client.GetNetworkConfigurationDiagnosticSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "network.WatchersClient", "GetNetworkConfigurationDiagnostic", result.Response(), "Failure sending request") + return + } + + return +} + +// GetNetworkConfigurationDiagnosticPreparer prepares the GetNetworkConfigurationDiagnostic request. +func (client WatchersClient) GetNetworkConfigurationDiagnosticPreparer(ctx context.Context, resourceGroupName string, networkWatcherName string, parameters ConfigurationDiagnosticParameters) (*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}/networkConfigurationDiagnostic", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkConfigurationDiagnosticSender sends the GetNetworkConfigurationDiagnostic request. The method will close the +// http.Response Body if it receives an error. +func (client WatchersClient) GetNetworkConfigurationDiagnosticSender(req *http.Request) (future WatchersGetNetworkConfigurationDiagnosticFuture, 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 +} + +// GetNetworkConfigurationDiagnosticResponder handles the response to the GetNetworkConfigurationDiagnostic request. The method always +// closes the http.Response Body. +func (client WatchersClient) GetNetworkConfigurationDiagnosticResponder(resp *http.Response) (result ConfigurationDiagnosticResponse, 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 +} + // GetNextHop gets the next hop from the specified VM. // Parameters: // resourceGroupName - the name of the resource group. @@ -1091,6 +1172,112 @@ 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. From 08cce0855464e030393ac7a7ba3621abe77f97da Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Thu, 16 Aug 2018 15:43:38 -0700 Subject: [PATCH 2/2] Generated from 6b8368dd434d71e004539fe305ae2c2c9cc100a3 (#2473) Removed QueryConnectionMonitors API --- .../preview/network/mgmt/network/models.go | 7 - .../network/mgmt/2018-06-01/network/models.go | 174 ------------------ .../mgmt/2018-06-01/network/watchers.go | 106 ----------- 3 files changed, 287 deletions(-) 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.