vendor: add github.com/Azure/azure-sdk-for-go and dependencies

This commit is contained in:
Nick Craig-Wood
2017-08-04 22:54:27 +01:00
parent 132f71d504
commit 91cfcc21ff
958 changed files with 320589 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
// Package networkwatcher implements the Azure ARM Networkwatcher service API
// version 2016-12-01.
//
// The Microsoft Azure Network management API provides a RESTful set of web
// services that interact with Microsoft Azure Networks service to manage your
// network resources. The API has entities that capture the relationship
// between an end user and the Microsoft Azure Networks service.
package networkwatcher
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
)
const (
// APIVersion is the version of the Networkwatcher
APIVersion = "2016-12-01"
// DefaultBaseURI is the default URI used for the service Networkwatcher
DefaultBaseURI = "https://management.azure.com"
)
// ManagementClient is the base client for Networkwatcher.
type ManagementClient struct {
autorest.Client
BaseURI string
APIVersion string
SubscriptionID string
}
// New creates an instance of the ManagementClient client.
func New(subscriptionID string) ManagementClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewWithBaseURI creates an instance of the ManagementClient client.
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
return ManagementClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
APIVersion: APIVersion,
SubscriptionID: subscriptionID,
}
}
+513
View File
@@ -0,0 +1,513 @@
package networkwatcher
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/date"
)
// Access enumerates the values for access.
type Access string
const (
// Allow specifies the allow state for access.
Allow Access = "Allow"
// Deny specifies the deny state for access.
Deny Access = "Deny"
)
// AssociationType enumerates the values for association type.
type AssociationType string
const (
// Associated specifies the associated state for association type.
Associated AssociationType = "Associated"
// Contains specifies the contains state for association type.
Contains AssociationType = "Contains"
)
// Direction enumerates the values for direction.
type Direction string
const (
// Inbound specifies the inbound state for direction.
Inbound Direction = "Inbound"
// Outbound specifies the outbound state for direction.
Outbound Direction = "Outbound"
)
// NextHopType enumerates the values for next hop type.
type NextHopType string
const (
// HyperNetGateway specifies the hyper net gateway state for next hop type.
HyperNetGateway NextHopType = "HyperNetGateway"
// Internet specifies the internet state for next hop type.
Internet NextHopType = "Internet"
// None specifies the none state for next hop type.
None NextHopType = "None"
// VirtualAppliance specifies the virtual appliance state for next hop
// type.
VirtualAppliance NextHopType = "VirtualAppliance"
// VirtualNetworkGateway specifies the virtual network gateway state for
// next hop type.
VirtualNetworkGateway NextHopType = "VirtualNetworkGateway"
// VnetLocal specifies the vnet local state for next hop type.
VnetLocal NextHopType = "VnetLocal"
)
// PcError enumerates the values for pc error.
type PcError string
const (
// AgentStopped specifies the agent stopped state for pc error.
AgentStopped PcError = "AgentStopped"
// CaptureFailed specifies the capture failed state for pc error.
CaptureFailed PcError = "CaptureFailed"
// InternalError specifies the internal error state for pc error.
InternalError PcError = "InternalError"
// LocalFileFailed specifies the local file failed state for pc error.
LocalFileFailed PcError = "LocalFileFailed"
// StorageFailed specifies the storage failed state for pc error.
StorageFailed PcError = "StorageFailed"
)
// PcProtocol enumerates the values for pc protocol.
type PcProtocol string
const (
// Any specifies the any state for pc protocol.
Any PcProtocol = "Any"
// TCP specifies the tcp state for pc protocol.
TCP PcProtocol = "TCP"
// UDP specifies the udp state for pc protocol.
UDP PcProtocol = "UDP"
)
// PcStatus enumerates the values for pc status.
type PcStatus string
const (
// Error specifies the error state for pc status.
Error PcStatus = "Error"
// NotStarted specifies the not started state for pc status.
NotStarted PcStatus = "NotStarted"
// Running specifies the running state for pc status.
Running PcStatus = "Running"
// Stopped specifies the stopped state for pc status.
Stopped PcStatus = "Stopped"
// Unknown specifies the unknown state for pc status.
Unknown PcStatus = "Unknown"
)
// Protocol enumerates the values for protocol.
type Protocol string
const (
// ProtocolTCP specifies the protocol tcp state for protocol.
ProtocolTCP Protocol = "TCP"
// ProtocolUDP specifies the protocol udp state for protocol.
ProtocolUDP Protocol = "UDP"
)
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
// Deleting specifies the deleting state for provisioning state.
Deleting ProvisioningState = "Deleting"
// Failed specifies the failed state for provisioning state.
Failed ProvisioningState = "Failed"
// Succeeded specifies the succeeded state for provisioning state.
Succeeded ProvisioningState = "Succeeded"
// Updating specifies the updating state for provisioning state.
Updating ProvisioningState = "Updating"
)
// SecurityRuleAccess enumerates the values for security rule access.
type SecurityRuleAccess string
const (
// SecurityRuleAccessAllow specifies the security rule access allow state
// for security rule access.
SecurityRuleAccessAllow SecurityRuleAccess = "Allow"
// SecurityRuleAccessDeny specifies the security rule access deny state for
// security rule access.
SecurityRuleAccessDeny SecurityRuleAccess = "Deny"
)
// SecurityRuleDirection enumerates the values for security rule direction.
type SecurityRuleDirection string
const (
// SecurityRuleDirectionInbound specifies the security rule direction
// inbound state for security rule direction.
SecurityRuleDirectionInbound SecurityRuleDirection = "Inbound"
// SecurityRuleDirectionOutbound specifies the security rule direction
// outbound state for security rule direction.
SecurityRuleDirectionOutbound SecurityRuleDirection = "Outbound"
)
// SecurityRuleProtocol enumerates the values for security rule protocol.
type SecurityRuleProtocol string
const (
// SecurityRuleProtocolAsterisk specifies the security rule protocol
// asterisk state for security rule protocol.
SecurityRuleProtocolAsterisk SecurityRuleProtocol = "*"
// SecurityRuleProtocolTCP specifies the security rule protocol tcp state
// for security rule protocol.
SecurityRuleProtocolTCP SecurityRuleProtocol = "Tcp"
// SecurityRuleProtocolUDP specifies the security rule protocol udp state
// for security rule protocol.
SecurityRuleProtocolUDP SecurityRuleProtocol = "Udp"
)
// EffectiveNetworkSecurityRule is effective network security rules.
type EffectiveNetworkSecurityRule struct {
Name *string `json:"name,omitempty"`
Protocol SecurityRuleProtocol `json:"protocol,omitempty"`
SourcePortRange *string `json:"sourcePortRange,omitempty"`
DestinationPortRange *string `json:"destinationPortRange,omitempty"`
SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"`
DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"`
ExpandedSourceAddressPrefix *[]string `json:"expandedSourceAddressPrefix,omitempty"`
ExpandedDestinationAddressPrefix *[]string `json:"expandedDestinationAddressPrefix,omitempty"`
Access SecurityRuleAccess `json:"access,omitempty"`
Priority *int32 `json:"priority,omitempty"`
Direction SecurityRuleDirection `json:"direction,omitempty"`
}
// FlowLogInformation is information on the configuration of flow log.
type FlowLogInformation struct {
autorest.Response `json:"-"`
TargetResourceID *string `json:"targetResourceId,omitempty"`
*FlowLogProperties `json:"properties,omitempty"`
}
// FlowLogProperties is parameters that define the configuration of flow log.
type FlowLogProperties struct {
StorageID *string `json:"storageId,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
RetentionPolicy *RetentionPolicyParameters `json:"retentionPolicy,omitempty"`
}
// FlowLogStatusParameters is parameters that define a resource to query flow
// log status.
type FlowLogStatusParameters struct {
TargetResourceID *string `json:"targetResourceId,omitempty"`
}
// ListResult is list of network watcher resources.
type ListResult struct {
autorest.Response `json:"-"`
Value *[]NetworkWatcher `json:"value,omitempty"`
}
// NetworkInterfaceAssociation is network interface and its custom security
// rules.
type NetworkInterfaceAssociation struct {
ID *string `json:"id,omitempty"`
SecurityRules *[]SecurityRule `json:"securityRules,omitempty"`
}
// NetworkWatcher is network watcher in a resource group.
type NetworkWatcher struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
Etag *string `json:"etag,omitempty"`
*PropertiesFormat `json:"properties,omitempty"`
}
// NextHopParameters is parameters that define the source and destination
// endpoint.
type NextHopParameters struct {
TargetResourceID *string `json:"targetResourceId,omitempty"`
SourceIPAddress *string `json:"sourceIPAddress,omitempty"`
DestinationIPAddress *string `json:"destinationIPAddress,omitempty"`
TargetNicResourceID *string `json:"targetNicResourceId,omitempty"`
}
// NextHopResult is the information about next hop from the specified VM.
type NextHopResult struct {
autorest.Response `json:"-"`
NextHopType NextHopType `json:"nextHopType,omitempty"`
NextHopIPAddress *string `json:"nextHopIpAddress,omitempty"`
RouteTableID *string `json:"routeTableId,omitempty"`
}
// PacketCapture is parameters that define the create packet capture operation.
type PacketCapture struct {
*PacketCaptureParameters `json:"properties,omitempty"`
}
// PacketCaptureFilter is filter that is applied to packet capture request.
// Multiple filters can be applied.
type PacketCaptureFilter struct {
Protocol PcProtocol `json:"protocol,omitempty"`
LocalIPAddress *string `json:"localIPAddress,omitempty"`
RemoteIPAddress *string `json:"remoteIPAddress,omitempty"`
LocalPort *string `json:"localPort,omitempty"`
RemotePort *string `json:"remotePort,omitempty"`
}
// PacketCaptureListResult is list of packet capture sessions.
type PacketCaptureListResult struct {
autorest.Response `json:"-"`
Value *[]PacketCaptureResult `json:"value,omitempty"`
}
// PacketCaptureParameters is parameters that define the create packet capture
// operation.
type PacketCaptureParameters struct {
Target *string `json:"target,omitempty"`
BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"`
TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"`
TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"`
StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"`
Filters *[]PacketCaptureFilter `json:"filters,omitempty"`
}
// PacketCaptureQueryStatusResult is status of packet capture session.
type PacketCaptureQueryStatusResult struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
CaptureStartTime *date.Time `json:"captureStartTime,omitempty"`
PacketCaptureStatus PcStatus `json:"packetCaptureStatus,omitempty"`
StopReason *string `json:"stopReason,omitempty"`
PacketCaptureError *[]PcError `json:"packetCaptureError,omitempty"`
}
// PacketCaptureResult is information about packet capture session.
type PacketCaptureResult struct {
autorest.Response `json:"-"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Etag *string `json:"etag,omitempty"`
*PacketCaptureResultProperties `json:"properties,omitempty"`
}
// PacketCaptureResultProperties is describes the properties of a packet
// capture session.
type PacketCaptureResultProperties struct {
Target *string `json:"target,omitempty"`
BytesToCapturePerPacket *int32 `json:"bytesToCapturePerPacket,omitempty"`
TotalBytesPerSession *int32 `json:"totalBytesPerSession,omitempty"`
TimeLimitInSeconds *int32 `json:"timeLimitInSeconds,omitempty"`
StorageLocation *PacketCaptureStorageLocation `json:"storageLocation,omitempty"`
Filters *[]PacketCaptureFilter `json:"filters,omitempty"`
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}
// PacketCaptureStorageLocation is describes the storage location for a packet
// capture session.
type PacketCaptureStorageLocation struct {
StorageID *string `json:"storageId,omitempty"`
StoragePath *string `json:"storagePath,omitempty"`
FilePath *string `json:"filePath,omitempty"`
}
// PropertiesFormat is the network watcher properties.
type PropertiesFormat struct {
ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
}
// QueryTroubleshootingParameters is parameters that define the resource to
// query the troubleshooting result.
type QueryTroubleshootingParameters struct {
TargetResourceID *string `json:"targetResourceId,omitempty"`
}
// Resource is
type Resource struct {
ID *string `json:"id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Location *string `json:"location,omitempty"`
Tags *map[string]*string `json:"tags,omitempty"`
}
// RetentionPolicyParameters is parameters that define the retention policy for
// flow log.
type RetentionPolicyParameters struct {
Days *int32 `json:"days,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
// SecurityGroupNetworkInterface is network interface and all its associated
// security rules.
type SecurityGroupNetworkInterface struct {
ID *string `json:"id,omitempty"`
SecurityRuleAssociations *SecurityRuleAssociations `json:"securityRuleAssociations,omitempty"`
}
// SecurityGroupViewParameters is parameters that define the VM to check
// security groups for.
type SecurityGroupViewParameters struct {
TargetResourceID *string `json:"targetResourceId,omitempty"`
}
// SecurityGroupViewResult is the information about security rules applied to
// the specified VM.
type SecurityGroupViewResult struct {
autorest.Response `json:"-"`
NetworkInterfaces *[]SecurityGroupNetworkInterface `json:"networkInterfaces,omitempty"`
}
// SecurityRule is network security rule.
type SecurityRule struct {
ID *string `json:"id,omitempty"`
*SecurityRulePropertiesFormat `json:"properties,omitempty"`
Name *string `json:"name,omitempty"`
Etag *string `json:"etag,omitempty"`
}
// SecurityRuleAssociations is all security rules associated with the network
// interface.
type SecurityRuleAssociations struct {
NetworkInterfaceAssociation *NetworkInterfaceAssociation `json:"networkInterfaceAssociation,omitempty"`
SubnetAssociation *SubnetAssociation `json:"subnetAssociation,omitempty"`
DefaultSecurityRules *[]SecurityRule `json:"defaultSecurityRules,omitempty"`
EffectiveSecurityRules *[]EffectiveNetworkSecurityRule `json:"effectiveSecurityRules,omitempty"`
}
// SecurityRulePropertiesFormat is
type SecurityRulePropertiesFormat struct {
Description *string `json:"description,omitempty"`
Protocol SecurityRuleProtocol `json:"protocol,omitempty"`
SourcePortRange *string `json:"sourcePortRange,omitempty"`
DestinationPortRange *string `json:"destinationPortRange,omitempty"`
SourceAddressPrefix *string `json:"sourceAddressPrefix,omitempty"`
DestinationAddressPrefix *string `json:"destinationAddressPrefix,omitempty"`
Access SecurityRuleAccess `json:"access,omitempty"`
Priority *int32 `json:"priority,omitempty"`
Direction SecurityRuleDirection `json:"direction,omitempty"`
ProvisioningState *string `json:"provisioningState,omitempty"`
}
// SubnetAssociation is network interface and its custom security rules.
type SubnetAssociation struct {
ID *string `json:"id,omitempty"`
SecurityRules *[]SecurityRule `json:"securityRules,omitempty"`
}
// SubResource is
type SubResource struct {
ID *string `json:"id,omitempty"`
}
// Topology is topology of the specified resource group.
type Topology struct {
autorest.Response `json:"-"`
ID *string `json:"id,omitempty"`
CreatedDateTime *date.Time `json:"createdDateTime,omitempty"`
LastModified *date.Time `json:"lastModified,omitempty"`
Resources *[]TopologyResource `json:"resources,omitempty"`
}
// TopologyAssociation is resources that have an association with the parent
// resource.
type TopologyAssociation struct {
Name *string `json:"name,omitempty"`
ResourceID *string `json:"resourceId,omitempty"`
AssociationType AssociationType `json:"associationType,omitempty"`
}
// TopologyParameters is parameters that define the representation of topology.
type TopologyParameters struct {
TargetResourceGroupName *string `json:"targetResourceGroupName,omitempty"`
}
// TopologyResource is the network resource topology information for the given
// resource group.
type TopologyResource struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Location *string `json:"location,omitempty"`
Associations *[]TopologyAssociation `json:"associations,omitempty"`
}
// TroubleshootingDetails is information gained from troubleshooting of
// specified resource.
type TroubleshootingDetails struct {
ID *string `json:"id,omitempty"`
ReasonType *string `json:"reasonType,omitempty"`
Summary *string `json:"summary,omitempty"`
Detail *string `json:"detail,omitempty"`
RecommendedActions *[]TroubleshootingRecommendedActions `json:"recommendedActions,omitempty"`
}
// TroubleshootingParameters is parameters that define the resource to
// troubleshoot.
type TroubleshootingParameters struct {
TargetResourceID *string `json:"targetResourceId,omitempty"`
*TroubleshootingProperties `json:"properties,omitempty"`
}
// TroubleshootingProperties is storage location provided for troubleshoot.
type TroubleshootingProperties struct {
StorageID *string `json:"storageId,omitempty"`
StoragePath *string `json:"storagePath,omitempty"`
}
// TroubleshootingRecommendedActions is recommended actions based on discovered
// issues.
type TroubleshootingRecommendedActions struct {
ActionID *string `json:"actionId,omitempty"`
ActionText *string `json:"actionText,omitempty"`
ActionURI *string `json:"actionUri,omitempty"`
ActionURIText *string `json:"actionUriText,omitempty"`
}
// TroubleshootingResult is troubleshooting information gained from specified
// resource.
type TroubleshootingResult struct {
autorest.Response `json:"-"`
StartTime *date.Time `json:"startTime,omitempty"`
EndTime *date.Time `json:"endTime,omitempty"`
Code *string `json:"code,omitempty"`
Results *[]TroubleshootingDetails `json:"results,omitempty"`
}
// VerificationIPFlowParameters is parameters that define the IP flow to be
// verified.
type VerificationIPFlowParameters struct {
TargetResourceID *string `json:"targetResourceId,omitempty"`
Direction Direction `json:"direction,omitempty"`
Protocol Protocol `json:"protocol,omitempty"`
LocalPort *string `json:"localPort,omitempty"`
RemotePort *string `json:"remotePort,omitempty"`
LocalIPAddress *string `json:"localIPAddress,omitempty"`
RemoteIPAddress *string `json:"remoteIPAddress,omitempty"`
TargetNicResourceID *string `json:"targetNicResourceId,omitempty"`
}
// VerificationIPFlowResult is results of IP flow verification on the target
// resource.
type VerificationIPFlowResult struct {
autorest.Response `json:"-"`
Access Access `json:"access,omitempty"`
RuleName *string `json:"ruleName,omitempty"`
}
@@ -0,0 +1,981 @@
package networkwatcher
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// NetworkWatchersClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resources. The API has entities that
// capture the relationship between an end user and the Microsoft Azure
// Networks service.
type NetworkWatchersClient struct {
ManagementClient
}
// NewNetworkWatchersClient creates an instance of the NetworkWatchersClient
// client.
func NewNetworkWatchersClient(subscriptionID string) NetworkWatchersClient {
return NewNetworkWatchersClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewNetworkWatchersClientWithBaseURI creates an instance of the
// NetworkWatchersClient client.
func NewNetworkWatchersClientWithBaseURI(baseURI string, subscriptionID string) NetworkWatchersClient {
return NetworkWatchersClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// CreateOrUpdate creates or updates a network watcher in the specified
// resource group.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. parameters is parameters that define the
// network watcher resource.
func (client NetworkWatchersClient) CreateOrUpdate(resourceGroupName string, networkWatcherName string, parameters NetworkWatcher) (result NetworkWatcher, err error) {
req, err := client.CreateOrUpdatePreparer(resourceGroupName, networkWatcherName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", nil, "Failure preparing request")
}
resp, err := client.CreateOrUpdateSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", resp, "Failure sending request")
}
result, err = client.CreateOrUpdateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "CreateOrUpdate", resp, "Failure responding to request")
}
return
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
func (client NetworkWatchersClient) CreateOrUpdatePreparer(resourceGroupName string, networkWatcherName string, parameters NetworkWatcher) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) CreateOrUpdateResponder(resp *http.Response) (result NetworkWatcher, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Delete deletes the specified network watcher resource. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher.
func (client NetworkWatchersClient) Delete(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client NetworkWatchersClient) DeletePreparer(resourceGroupName string, networkWatcherName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets the specified network watcher by resource group.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher.
func (client NetworkWatchersClient) Get(resourceGroupName string, networkWatcherName string) (result NetworkWatcher, err error) {
req, err := client.GetPreparer(resourceGroupName, networkWatcherName)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client NetworkWatchersClient) GetPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) GetResponder(resp *http.Response) (result NetworkWatcher, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetFlowLogStatus queries status of flow log on a specified resource. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the network watcher resource group.
// networkWatcherName is the name of the network watcher resource. parameters
// is parameters that define a resource to query flow log status.
func (client NetworkWatchersClient) GetFlowLogStatus(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus")
}
req, err := client.GetFlowLogStatusPreparer(resourceGroupName, networkWatcherName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", nil, "Failure preparing request")
}
resp, err := client.GetFlowLogStatusSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", resp, "Failure sending request")
}
result, err = client.GetFlowLogStatusResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetFlowLogStatus", resp, "Failure responding to request")
}
return
}
// GetFlowLogStatusPreparer prepares the GetFlowLogStatus request.
func (client NetworkWatchersClient) GetFlowLogStatusPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogStatusParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryFlowLogStatus", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// GetFlowLogStatusSender sends the GetFlowLogStatus request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) GetFlowLogStatusSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// GetFlowLogStatusResponder handles the response to the GetFlowLogStatus request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) GetFlowLogStatusResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// GetNextHop gets the next hop from the specified VM. This method may poll for
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. parameters is parameters that define the
// source and destination endpoint.
func (client NetworkWatchersClient) GetNextHop(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (result autorest.Response, 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.SourceIPAddress", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.DestinationIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop")
}
req, err := client.GetNextHopPreparer(resourceGroupName, networkWatcherName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", nil, "Failure preparing request")
}
resp, err := client.GetNextHopSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", resp, "Failure sending request")
}
result, err = client.GetNextHopResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetNextHop", resp, "Failure responding to request")
}
return
}
// GetNextHopPreparer prepares the GetNextHop request.
func (client NetworkWatchersClient) GetNextHopPreparer(resourceGroupName string, networkWatcherName string, parameters NextHopParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/nextHop", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// GetNextHopSender sends the GetNextHop request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) GetNextHopSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// GetNextHopResponder handles the response to the GetNextHop request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) GetNextHopResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// GetTopology gets the current network topology by resource group.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. parameters is parameters that define the
// representation of topology.
func (client NetworkWatchersClient) GetTopology(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (result Topology, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.TargetResourceGroupName", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTopology")
}
req, err := client.GetTopologyPreparer(resourceGroupName, networkWatcherName, parameters)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", nil, "Failure preparing request")
}
resp, err := client.GetTopologySender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", resp, "Failure sending request")
}
result, err = client.GetTopologyResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTopology", resp, "Failure responding to request")
}
return
}
// GetTopologyPreparer prepares the GetTopology request.
func (client NetworkWatchersClient) GetTopologyPreparer(resourceGroupName string, networkWatcherName string, parameters TopologyParameters) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/topology", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetTopologySender sends the GetTopology request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) GetTopologySender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetTopologyResponder handles the response to the GetTopology request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) GetTopologyResponder(resp *http.Response) (result Topology, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetTroubleshooting initiate troubleshooting on a specified resource This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher resource. parameters is parameters that
// define the resource to troubleshoot.
func (client NetworkWatchersClient) GetTroubleshooting(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (result autorest.Response, 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.TroubleshootingProperties", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.TroubleshootingProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.TroubleshootingProperties.StoragePath", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting")
}
req, err := client.GetTroubleshootingPreparer(resourceGroupName, networkWatcherName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", nil, "Failure preparing request")
}
resp, err := client.GetTroubleshootingSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", resp, "Failure sending request")
}
result, err = client.GetTroubleshootingResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshooting", resp, "Failure responding to request")
}
return
}
// GetTroubleshootingPreparer prepares the GetTroubleshooting request.
func (client NetworkWatchersClient) GetTroubleshootingPreparer(resourceGroupName string, networkWatcherName string, parameters TroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/troubleshoot", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// GetTroubleshootingSender sends the GetTroubleshooting request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) GetTroubleshootingSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// GetTroubleshootingResponder handles the response to the GetTroubleshooting request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) GetTroubleshootingResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// GetTroubleshootingResult get the last completed troubleshooting result on a
// specified resource This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher resource. parameters is parameters that
// define the resource to query the troubleshooting result.
func (client NetworkWatchersClient) GetTroubleshootingResult(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult")
}
req, err := client.GetTroubleshootingResultPreparer(resourceGroupName, networkWatcherName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", nil, "Failure preparing request")
}
resp, err := client.GetTroubleshootingResultSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", resp, "Failure sending request")
}
result, err = client.GetTroubleshootingResultResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetTroubleshootingResult", resp, "Failure responding to request")
}
return
}
// GetTroubleshootingResultPreparer prepares the GetTroubleshootingResult request.
func (client NetworkWatchersClient) GetTroubleshootingResultPreparer(resourceGroupName string, networkWatcherName string, parameters QueryTroubleshootingParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/queryTroubleshootResult", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// GetTroubleshootingResultSender sends the GetTroubleshootingResult request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) GetTroubleshootingResultSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// GetTroubleshootingResultResponder handles the response to the GetTroubleshootingResult request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) GetTroubleshootingResultResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// GetVMSecurityRules gets the configured and effective security group rules on
// the specified VM. This method may poll for completion. Polling can be
// canceled by passing the cancel channel argument. The channel will be used to
// cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. parameters is parameters that define the VM
// to check security groups for.
func (client NetworkWatchersClient) GetVMSecurityRules(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.TargetResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules")
}
req, err := client.GetVMSecurityRulesPreparer(resourceGroupName, networkWatcherName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", nil, "Failure preparing request")
}
resp, err := client.GetVMSecurityRulesSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", resp, "Failure sending request")
}
result, err = client.GetVMSecurityRulesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "GetVMSecurityRules", resp, "Failure responding to request")
}
return
}
// GetVMSecurityRulesPreparer prepares the GetVMSecurityRules request.
func (client NetworkWatchersClient) GetVMSecurityRulesPreparer(resourceGroupName string, networkWatcherName string, parameters SecurityGroupViewParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/securityGroupView", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// GetVMSecurityRulesSender sends the GetVMSecurityRules request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) GetVMSecurityRulesSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// GetVMSecurityRulesResponder handles the response to the GetVMSecurityRules request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) GetVMSecurityRulesResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// List gets all network watchers by resource group.
//
// resourceGroupName is the name of the resource group.
func (client NetworkWatchersClient) List(resourceGroupName string) (result ListResult, err error) {
req, err := client.ListPreparer(resourceGroupName)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client NetworkWatchersClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) ListResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// ListAll gets all network watchers by subscription.
func (client NetworkWatchersClient) ListAll() (result ListResult, err error) {
req, err := client.ListAllPreparer()
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", nil, "Failure preparing request")
}
resp, err := client.ListAllSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", resp, "Failure sending request")
}
result, err = client.ListAllResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "ListAll", resp, "Failure responding to request")
}
return
}
// ListAllPreparer prepares the ListAll request.
func (client NetworkWatchersClient) ListAllPreparer() (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/networkWatchers", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListAllSender sends the ListAll request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) ListAllSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListAllResponder handles the response to the ListAll request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) ListAllResponder(resp *http.Response) (result ListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// SetFlowLogConfiguration configures flow log on a specified resource. This
// method may poll for completion. Polling can be canceled by passing the
// cancel channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the network watcher resource group.
// networkWatcherName is the name of the network watcher resource. parameters
// is parameters that define the configuration of flow log.
func (client NetworkWatchersClient) SetFlowLogConfiguration(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (result autorest.Response, 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.FlowLogProperties", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.FlowLogProperties.StorageID", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.FlowLogProperties.Enabled", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration")
}
req, err := client.SetFlowLogConfigurationPreparer(resourceGroupName, networkWatcherName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", nil, "Failure preparing request")
}
resp, err := client.SetFlowLogConfigurationSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", resp, "Failure sending request")
}
result, err = client.SetFlowLogConfigurationResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "SetFlowLogConfiguration", resp, "Failure responding to request")
}
return
}
// SetFlowLogConfigurationPreparer prepares the SetFlowLogConfiguration request.
func (client NetworkWatchersClient) SetFlowLogConfigurationPreparer(resourceGroupName string, networkWatcherName string, parameters FlowLogInformation, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/configureFlowLog", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// SetFlowLogConfigurationSender sends the SetFlowLogConfiguration request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) SetFlowLogConfigurationSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// SetFlowLogConfigurationResponder handles the response to the SetFlowLogConfiguration request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) SetFlowLogConfigurationResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// VerifyIPFlow verify IP flow from the specified VM to a location given the
// currently configured NSG rules. This method may poll for completion. Polling
// can be canceled by passing the cancel channel argument. The channel will be
// used to cancel polling and any outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. parameters is parameters that define the IP
// flow to be verified.
func (client NetworkWatchersClient) VerifyIPFlow(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (result autorest.Response, 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.LocalPort", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.RemotePort", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.LocalIPAddress", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.RemoteIPAddress", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow")
}
req, err := client.VerifyIPFlowPreparer(resourceGroupName, networkWatcherName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", nil, "Failure preparing request")
}
resp, err := client.VerifyIPFlowSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", resp, "Failure sending request")
}
result, err = client.VerifyIPFlowResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.NetworkWatchersClient", "VerifyIPFlow", resp, "Failure responding to request")
}
return
}
// VerifyIPFlowPreparer prepares the VerifyIPFlow request.
func (client NetworkWatchersClient) VerifyIPFlowPreparer(resourceGroupName string, networkWatcherName string, parameters VerificationIPFlowParameters, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/ipFlowVerify", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// VerifyIPFlowSender sends the VerifyIPFlow request. The method will close the
// http.Response Body if it receives an error.
func (client NetworkWatchersClient) VerifyIPFlowSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// VerifyIPFlowResponder handles the response to the VerifyIPFlow request. The method always
// closes the http.Response Body.
func (client NetworkWatchersClient) VerifyIPFlowResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
@@ -0,0 +1,463 @@
package networkwatcher
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// PacketCapturesClient is the the Microsoft Azure Network management API
// provides a RESTful set of web services that interact with Microsoft Azure
// Networks service to manage your network resources. The API has entities that
// capture the relationship between an end user and the Microsoft Azure
// Networks service.
type PacketCapturesClient struct {
ManagementClient
}
// NewPacketCapturesClient creates an instance of the PacketCapturesClient
// client.
func NewPacketCapturesClient(subscriptionID string) PacketCapturesClient {
return NewPacketCapturesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}
// NewPacketCapturesClientWithBaseURI creates an instance of the
// PacketCapturesClient client.
func NewPacketCapturesClientWithBaseURI(baseURI string, subscriptionID string) PacketCapturesClient {
return PacketCapturesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Create create and start a packet capture on the specified VM. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. packetCaptureName is the name of the packet
// capture session. parameters is parameters that define the create packet
// capture operation.
func (client PacketCapturesClient) Create(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (result autorest.Response, err error) {
if err := validation.Validate([]validation.Validation{
{TargetValue: parameters,
Constraints: []validation.Constraint{{Target: "parameters.PacketCaptureParameters", Name: validation.Null, Rule: true,
Chain: []validation.Constraint{{Target: "parameters.PacketCaptureParameters.Target", Name: validation.Null, Rule: true, Chain: nil},
{Target: "parameters.PacketCaptureParameters.StorageLocation", Name: validation.Null, Rule: true, Chain: nil},
}}}}}); err != nil {
return result, validation.NewErrorWithValidationError(err, "networkwatcher.PacketCapturesClient", "Create")
}
req, err := client.CreatePreparer(resourceGroupName, networkWatcherName, packetCaptureName, parameters, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", nil, "Failure preparing request")
}
resp, err := client.CreateSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", resp, "Failure sending request")
}
result, err = client.CreateResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Create", resp, "Failure responding to request")
}
return
}
// CreatePreparer prepares the Create request.
func (client PacketCapturesClient) CreatePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, parameters PacketCapture, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsJSON(),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters),
autorest.WithJSON(parameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// CreateSender sends the Create request. The method will close the
// http.Response Body if it receives an error.
func (client PacketCapturesClient) CreateSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// CreateResponder handles the response to the Create request. The method always
// closes the http.Response Body.
func (client PacketCapturesClient) CreateResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByClosing())
result.Response = resp
return
}
// Delete deletes the specified packet capture session. This method may poll
// for completion. Polling can be canceled by passing the cancel channel
// argument. The channel will be used to cancel polling and any outstanding
// HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. packetCaptureName is the name of the packet
// capture session.
func (client PacketCapturesClient) Delete(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.DeletePreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", nil, "Failure preparing request")
}
resp, err := client.DeleteSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", resp, "Failure sending request")
}
result, err = client.DeleteResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Delete", resp, "Failure responding to request")
}
return
}
// DeletePreparer prepares the Delete request.
func (client PacketCapturesClient) DeletePreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsDelete(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client PacketCapturesClient) DeleteSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func (client PacketCapturesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// Get gets a packet capture session by name.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. packetCaptureName is the name of the packet
// capture session.
func (client PacketCapturesClient) Get(resourceGroupName string, networkWatcherName string, packetCaptureName string) (result PacketCaptureResult, err error) {
req, err := client.GetPreparer(resourceGroupName, networkWatcherName, packetCaptureName)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", nil, "Failure preparing request")
}
resp, err := client.GetSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", resp, "Failure sending request")
}
result, err = client.GetResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Get", resp, "Failure responding to request")
}
return
}
// GetPreparer prepares the Get request.
func (client PacketCapturesClient) GetPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client PacketCapturesClient) GetSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client PacketCapturesClient) GetResponder(resp *http.Response) (result PacketCaptureResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// GetStatus query the status of a running packet capture session. This method
// may poll for completion. Polling can be canceled by passing the cancel
// channel argument. The channel will be used to cancel polling and any
// outstanding HTTP requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the Network Watcher resource. packetCaptureName is the name
// given to the packet capture session.
func (client PacketCapturesClient) GetStatus(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.GetStatusPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", nil, "Failure preparing request")
}
resp, err := client.GetStatusSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", resp, "Failure sending request")
}
result, err = client.GetStatusResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "GetStatus", resp, "Failure responding to request")
}
return
}
// GetStatusPreparer prepares the GetStatus request.
func (client PacketCapturesClient) GetStatusPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/queryStatus", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// GetStatusSender sends the GetStatus request. The method will close the
// http.Response Body if it receives an error.
func (client PacketCapturesClient) GetStatusSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// GetStatusResponder handles the response to the GetStatus request. The method always
// closes the http.Response Body.
func (client PacketCapturesClient) GetStatusResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
// List lists all packet capture sessions within the specified resource group.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the Network Watcher resource.
func (client PacketCapturesClient) List(resourceGroupName string, networkWatcherName string) (result PacketCaptureListResult, err error) {
req, err := client.ListPreparer(resourceGroupName, networkWatcherName)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", nil, "Failure preparing request")
}
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", resp, "Failure sending request")
}
result, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "List", resp, "Failure responding to request")
}
return
}
// ListPreparer prepares the List request.
func (client PacketCapturesClient) ListPreparer(resourceGroupName string, networkWatcherName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsGet(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{})
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client PacketCapturesClient) ListSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client, req)
}
// ListResponder handles the response to the List request. The method always
// closes the http.Response Body.
func (client PacketCapturesClient) ListResponder(resp *http.Response) (result PacketCaptureListResult, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
return
}
// Stop stops a specified packet capture session. This method may poll for
// completion. Polling can be canceled by passing the cancel channel argument.
// The channel will be used to cancel polling and any outstanding HTTP
// requests.
//
// resourceGroupName is the name of the resource group. networkWatcherName is
// the name of the network watcher. packetCaptureName is the name of the packet
// capture session.
func (client PacketCapturesClient) Stop(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (result autorest.Response, err error) {
req, err := client.StopPreparer(resourceGroupName, networkWatcherName, packetCaptureName, cancel)
if err != nil {
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", nil, "Failure preparing request")
}
resp, err := client.StopSender(req)
if err != nil {
result.Response = resp
return result, autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", resp, "Failure sending request")
}
result, err = client.StopResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "networkwatcher.PacketCapturesClient", "Stop", resp, "Failure responding to request")
}
return
}
// StopPreparer prepares the Stop request.
func (client PacketCapturesClient) StopPreparer(resourceGroupName string, networkWatcherName string, packetCaptureName string, cancel <-chan struct{}) (*http.Request, error) {
pathParameters := map[string]interface{}{
"networkWatcherName": autorest.Encode("path", networkWatcherName),
"packetCaptureName": autorest.Encode("path", packetCaptureName),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
queryParameters := map[string]interface{}{
"api-version": client.APIVersion,
}
preparer := autorest.CreatePreparer(
autorest.AsPost(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/networkWatchers/{networkWatcherName}/packetCaptures/{packetCaptureName}/stop", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare(&http.Request{Cancel: cancel})
}
// StopSender sends the Stop request. The method will close the
// http.Response Body if it receives an error.
func (client PacketCapturesClient) StopSender(req *http.Request) (*http.Response, error) {
return autorest.SendWithSender(client,
req,
azure.DoPollForAsynchronous(client.PollingDelay))
}
// StopResponder handles the response to the Stop request. The method always
// closes the http.Response Body.
func (client PacketCapturesClient) StopResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
autorest.ByClosing())
result.Response = resp
return
}
+60
View File
@@ -0,0 +1,60 @@
package networkwatcher
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator 1.0.1.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
import (
"bytes"
"fmt"
"strings"
)
const (
major = "8"
minor = "1"
patch = "0"
tag = "beta"
userAgentFormat = "Azure-SDK-For-Go/%s arm-%s/%s"
)
// cached results of UserAgent and Version to prevent repeated operations.
var (
userAgent string
version string
)
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
if userAgent == "" {
userAgent = fmt.Sprintf(userAgentFormat, Version(), "networkwatcher", "2016-12-01")
}
return userAgent
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
if version == "" {
versionBuilder := bytes.NewBufferString(fmt.Sprintf("%s.%s.%s", major, minor, patch))
if tag != "" {
versionBuilder.WriteRune('-')
versionBuilder.WriteString(strings.TrimPrefix(tag, "-"))
}
version = string(versionBuilder.Bytes())
}
return version
}