diff --git a/profiles/preview/network/mgmt/network/models.go b/profiles/preview/network/mgmt/network/models.go index be778f14bf57..5e310277cb8d 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 @@ -914,6 +917,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 +1077,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 @@ -1154,6 +1160,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 +1174,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 +1193,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,6 +1304,7 @@ 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 diff --git a/services/network/mgmt/2018-06-01/network/models.go b/services/network/mgmt/2018-06-01/network/models.go index f2488eb15c4e..d9ef6e372b5b 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. @@ -5853,6 +5874,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 +6518,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 +11992,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. @@ -14833,6 +14886,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 +15269,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 +15644,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 +19584,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 diff --git a/services/network/mgmt/2018-06-01/network/watchers.go b/services/network/mgmt/2018-06-01/network/watchers.go index b7cd682491c9..5a1813cc3797 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.